Date: Thu, 15 Jul 2010 13:46:59 -0400
Reply-To: Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject: Re: Macro error
On Thu, 15 Jul 2010 11:27:00 -0400, Dan Boisvert
<daniel.boisvert@GENZYME.COM> wrote:
...
>CALL SYMPUT does not create the macro variable until after the data step
has
>run. You just need to split this into two separate data steps.
Hi, Dan,
This is one of the things that are often misunderstood. The symput call
routine can create a macro variable (if not already exists in the scope)
during the data step's run time. Once created, then you can retrieve the
value immediately as well. You don't have to wait until the data step is
done running as demonstrated below. HTH.
Cheers,
Chang
%symdel mvar;
data _null_;
length var $10;
var = "nothing";
put "before " var;
call symput("mvar", "something");
var = symget("mvar");
put "after " var;
run;
/*
before nothing
after something
*/
|