Date: Thu, 16 Oct 2003 10:02:15 -0400
Reply-To: Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject: Re: new to macros, need help!! re-post.
Content-Type: text/plain
Ed,
If you are going to tighten up the code, I would suggest
%macro goplot(chip);
symbol1 i=hilot v=none;
proc gplot data=test; %*!!! probably SE.TEST is meant !!!;
plot &chip*time;
run;
%mend;
proc sql noprint ;
select '%goplot(' || name || ')' into: plotlist
from distionary.columns
where libname = "SE"
and memname = "TEST"
and name like "CHP%"
;
quit ;
&plotlist
From a design point of view,
%macro goplot (data=se.test,var1=,var2=time) ;
might be more useful.
IanWhitlock@westat.com
-----Original Message-----
From: Ed Heaton
Sent: Thursday, October 16, 2003 9:35 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: new to macros, need help!! re-post.
Dom,
I see that Ken Moody explained the real issue with your program. I'd just
like to point out that you can completely eliminate your first DATA step by
a little recoding of your PROC CONTENTS as follows.
Proc contents
data=se.test(keep=chp:)
out=memlist(keep=name)
noPrint
;
Run ;
Ed
Edward Heaton, Senior Systems Analyst,
Westat (An Employee-Owned Research Corporation),
1600 Research Boulevard, Room RW-3541, Rockville, MD 20850-3195
Voice: (301) 610-4818 Fax: (301) 610-5128
mailto:EdHeaton@westat.com http://www.westat.com
-----Original Message-----
From: dude [mailto:dude@DUDES.COM]
Sent: Wednesday, October 15, 2003 5:48 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: new to macros, need help!! re-post.
I'm trying to run a hilot plot against a dataset that has a variable number
of variables, I'd like to run the plot against a subset of these variables
that begin with CHP.
I'm taking a proc contents of the dataset, outputting into a dataset only
the variables that begin with CHP. This works fine, then I've created a
simple macro to plot the hilot plot for each of the variables, by passing
the variable name to the macro, however it does not work, I get the error
message listed below:
I can't find the unclosed DO; Any help is appreciated; Is there a simpler
way to do this?
Thanks,
Dom
SAS code folows:
proc contents data=se.test out=memlist noprint; run;
data memlist (keep=name);
set memlist;
if substr(name,1,3) ='CHP';
run;
%macro goplot(chip);
symbol1 i=hilot v=none;
proc gplot data=test;
plot &chip*time;
run;
%mend;
data _null_;
set memlist;
call symput( 'chip', trim(left(put(name, $9.))));
put chip;
if substr(name,1,3)='CHP' then do;
%goplot(chip);
end;
run;
quit;
ERROR messages follow:
NOTE: Line generated by the invoked macro "GOPLOT".
2076 proc gplot data=test; plot
&chip*time; run;
-
117
ERROR: Variable CHIP not found.
NOTE: The previous statement has been deleted.
ERROR 117-185: There was 1 unclosed DO block.
ERROR: At least one PLOT or BUBBLE statement must be given.
NOTE: The SAS System stopped processing this step because of errors.