Date: Thu, 20 Dec 2007 09:53:20 -0500
Reply-To: Jim Groeneveld <jim4stat@YAHOO.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim4stat@YAHOO.CO.UK>
Subject: Re: assigning column variable to macro variable
Hi Karma,
Why would you want to do that? Tell us the whole story.
There might be quite another solution for your problem.
Remember, a data step (dataset) variable takes the value
of one variable for each record or iteration at a time.
So, looping through a dataset, or iterating steps,
causes the value to be changed for every record/iteration.
A macro variable holds text only, e.g. SAS programming code,
for example a variable name. It might also contain the value
of a data step variable for a single given record or iteration,
but its value does not change implicitly, like with data step
variables. You you would have to specify which value it should
take, or you should specify many macro variables to hold the
values of various records of a dataset variable.
One of the solutions you got already creates many macro variables.
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
On Thu, 20 Dec 2007 05:35:58 -0800, karma <dorjetarap@GOOGLEMAIL.COM> wrote:
>Hi,
>
>I want to know if there is a way to make a column variable a global
>variable.
>
>The following doesn't work
>
>data _null_;
> set test;
> %global var1;
> %let var1=variableOne;
>run;
>
>This makes var1 resolve to the text variableOne, rather than the value
>in column variableOne. Any suggestions?
>
>Thanks
|