LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2012, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 27 Jan 2012 16:51:02 +0000
Reply-To:     "Zdeb, Michael S" <mzdeb@ALBANY.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Zdeb, Michael S" <mzdeb@ALBANY.EDU>
Subject:      Re: Macro Related - Interview Question
Comments: To: B & E Zimmerman <beezee62f@VERIZON.NET>
In-Reply-To:  <005d01ccdd14$e418b290$ac4a17b0$@net>
Content-Type: text/plain; charset="us-ascii"

hi ... so if most of the answers are SQL-related, how about a data step ..

data _null_; length vars $100; do until (done); set sashelp.vcolumn end=done; where libname='SASHELP' and memname='CLASS'; vars=catx(',',vars,name); end; call symputx('vars',vars); run;

%put |&vars|; LOG ... |Name,Sex,Age,Height,Weight|

SYMPUTX trims the value regardless of the length of VARS in the data step

and, as Joe said "If for some unknown reason there were a good reason to make individual macro variables, it would go something like this ..."

data _null_; do j=1 by 1 until (done); set sashelp.vcolumn end=done;; where libname='SASHELP' and memname='CLASS'; call symputx(catt('v',j),name); end; run;

%put &v1 &v2 &v3 &v4 &v5; LOG ... Name Sex Age Height Weight

ps this is pretty neat ... from Frank DiIorio, a two-page reference card ...

"Summary of SAS Dictionary Tables and Views" http://www.codecraftersinc.com/pdf/DictionaryTablesRefCard.pdf

Mike Zdeb U@Albany School of Public Health One University Place (Room 119) Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475

________________________________________ From: SAS(r) Discussion [SAS-L@LISTSERV.UGA.EDU] on behalf of B & E Zimmerman [beezee62f@VERIZON.NET] Sent: Friday, January 27, 2012 11:58 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Macro Related - Interview Question

Listers:

Thanks to everyone who replied (so quickly): Data _null_, Toby Dunn, Sterling Paramore, Joe Matise, Otto Burgess and anyone else I neglected to mention.

Basically most of the answers related to the dictionary tables (columns) capability of SAS combined with Proc SQL.

Thanks again,

Bernie Z.


Back to: Top of message | Previous page | Main SAS-L page