Date: Fri, 27 Apr 2001 14:06:58 -0500
Reply-To: Jonathan Goldberg <jonathan@MATLOCK.WUSTL.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jonathan Goldberg <jonathan@MATLOCK.WUSTL.EDU>
Subject: Re: Deleting a file in SAS
Content-Type: TEXT/PLAIN; charset=US-ASCII
During a discussion of creating a command string for use in the system
call routine,
"Terjeson, Mark" <TerjeMW@DSHS.WA.GOV>
wrote:
>The CALL SYMPUT() creates a macro variable just
>like the %LET. However, when the CALL SYMPUT()
>is used in the datastep the macro variable is *not*
>available until *after* the datastep is over. This is
>why your example does not work.
He is correct about the failure of the given example. But it is not quite
right to say that a macro variable variable created with CALL SYMPUT() is
not available until after the datastep is over. It can be accessed via
SYMGET, as in:
1 data _null_;
2 call symput('myvar', 'some text');
3 datavar = symget('myvar');
4 put datavar=;
5 run;
DATAVAR=some text
NOTE: DATA statement used:
real time 0.080 seconds
cpu time 0.011 seconds
It is true that normal &varname resolution will fail. And it's hard to
see why anyone would ever want to do what I did in everyday life. But
it's possible.
Jonathan Goldberg
Missouri Alcoholism Research Center
Dept. of Psychiatry
Washington University School of Medicine
40 N. Kingshighway, Suite One
St. Louis, MO 63108
314-286-2212