Date: Thu, 14 Sep 2006 19:43:23 -0700
Reply-To: Dale Remus <hellangel_987@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dale Remus <hellangel_987@YAHOO.COM>
Subject: Re: Extract variable names
In-Reply-To: <20060915024021.44297.qmail@web42110.mail.mud.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1
I have a relevant question,
After extracting the names of variables, and keep them
into a Macro, how do I know that how many names have
been extracted?
Thank you
Dale
> Reply-To: "Terjeson, Mark"
> <Mterjeson@RUSSELL.COM>
> Sender: "SAS(r) Discussion"
> <SAS-L@LISTSERV.UGA.EDU>
> From: "Terjeson, Mark"
> <Mterjeson@RUSSELL.COM>
> Subject: Re: Extract variable names
>
> Hi Drew,
>
> Here is a fairly common way. For libraries
> that you have open (i.e. LIBNAME) the view
> sashelp.vcolumn will have the names of all
> the datasets in all the open libraries. Of
> course you can use a datastep to fetch them
> as well and then output with call symput().
>
>
> * create sample ;
> data mydata;
> set sashelp.class;
> run;
>
> proc sql noprint;
> select name into :mvar separated by ','
> from sashelp.vcolumn
> where libname eq 'WORK'
> and memname eq 'MYDATA';
> quit;
>
> %put mvar is >&mvar<;
>
>
>
>
> Hope this is helpful.
>
>
> Mark Terjeson
> Senior Programmer Analyst, IM&R
> Russell Investment Group
>
>
> Russell
> Global Leaders in Multi-Manager Investing
>
>> -----Original Message-----
>> From: SAS(r) Discussion
>> Subject: Extract variable names
>>
>> My data set has many variables. I'd like to extract
>> the names of these
>> variables, and put them into a Macro variable, say
>> "name". The resutant
>> "name"
>> should look like as if it is from
>>
>> %let
>> name=%str(variable_1_name,variable_2_name,....);
>>
>> Can you kindly show me the way to it?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|