Date: Thu, 20 Dec 2007 07:23:54 -0800
Reply-To: karma <dorjetarap@GOOGLEMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: karma <dorjetarap@GOOGLEMAIL.COM>
Organization: http://groups.google.com
Subject: Re: assigning column variable to macro variable
Content-Type: text/plain; charset=ISO-8859-1
On Dec 20, 2:02 pm, Chris.Bro...@ONS.GOV.UK (Chris Brooks) wrote:
> Try this macro
>
> %%macro vname;
> %let dsid=%sysfunc(open(sashelp.class,i));
>
> %do i=1 %to %sysfunc(attrn(&dsid,nvars));
> %global var&i;
> %let var&i=%sysfunc(varname(&dsid,&i));
> %end;
> %let rc=%sysfunc(close(&dsid));
> %mend;
> %vname;
>
> Chris
>
> Chris Brooks
> SAS Technical Lead
> Office for National Statistics
> United Kingdom
>
> On Thu, 20 Dec 2007 05:35:58 -0800, karma <dorjeta...@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- Hide quoted text -
>
> - Show quoted text -
Hi Chris,
Can you please explain what this macro does? It looks like it creates
global variables for all column values?
Cheers
|