LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2002, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 26 Sep 2002 01:23:18 GMT
Reply-To:     "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Organization: EarthLink Inc. -- http://www.EarthLink.net
Subject:      Re: Multiple Graph Macro for GPlot
Content-Type: text/plain;

"Dylan" <dylanroth@hotmail.com> wrote in message news:79b374ac.0209251133.1570b19@posting.google.com... > I have a large data set in which I want to subset the output into > separate graphs by date (with a corresponding title change for each > date). Below is the code for a macro which prints a chart for a > specific date (TGT) and model type (SAMPLE_MODEL); this code works: > > %MACRO SAMPLE_PLOT_2 (TGT=, SAMPLE_MODEL=); > goptions gunit=pct > hsize=7 in vsize=5 in > ftext=zapf htitle=3 htext=2 border; > proc gplot data=month.SAMPLE2_OUT_&SAMPLE_MODEL; > where TGT=&TGT; > plot (P1_FIT_1 FIT_1)*T / overlay frame; > symbol1 value=dot h=1 i=join color=red; > symbol2 value=dot i=join color=blue; > title "Bookings for Date &TGT"; > footnote "Red = Predicted, Blue = Actual"; > run; > %MEND SAMPLE_PLOT_2; > > I then want to write a second macro that will loop through a series of > dates specified by a beginning date (BEG_DATE) and an end date > (END_DATE) invoking SAMPLE_PLOT_2 for each date. Below is the code I > have written; it does not work: > > %MACRO SAMPLE_PLOT_3(BEG_DATE=, END_DATE=); > Do TGT=&BEG_DATE to &END_DATE; > SAMPLE_PLOT_2(TGT=&TGT, SAMPLE_MODEL=1); > run; > end; > %MEND SAMPLE_PLOT_3; > > I know the way the code is written that there is a problem in the > TGT=&TGT line but I don&#8217;t know how to fix it or redefine it (my > attempts at using %LET and Call Symput statements were not > successful). Any suggestions would be appreciated. > > Thanks, > Dylan

First, your Sample_Plot_3 can't possibly be the code you are using, the Do is not a %do, the to is not a %to, your sample_plot_2 invocation is not %sample_plot_2. You dont' specify how beg_date is passed, is a number or a date constant ?

Try this:

%Macro PlotThem (beg_date=, end_date=);

%local date; %do date = %sysevalf (&beg_date) %to %sysevalf (&end_date); %Sample_Plot_2 (tgt=&date, sample_model=1) %end;

%Mend;

%PlotThem (beg_date = '01jan00'd, end_date='10jan00'd);

%sysevalf will return the number represented by the date constant it is passed. If beg_date is already the number representing the date of interest, %sysevalf will return it unchanged.

-- Richard A. DeVenezia http://www.devenezia.com/downloads/sas/macros/#sas2xls Use Perl to create an Excel file containing one worksheet per SAS dataset


Back to: Top of message | Previous page | Main SAS-L page