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 (July 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 28 Jul 2008 16:31:32 -0400
Reply-To:     "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Subject:      Re: How to put variable name ?
In-Reply-To:  <001201c8f112$6db28320$49178960$@com.br>
Content-Type: text/plain; charset=us-ascii

> From: Adriano Rodrigues > Checking some data with:

> data errors; > set all; > array vars(*) p17a -- p17z;

> do i=1 to dim(vars); > if vars(i) notin (1,2) then put 'quest=' quest 'error='vars(i) ; > end ;

> run; > > my log:

> quest=56 error=3; > > wanted log: > > quest=56 error=3 variable=p17n; > > can someone help me? I don't know how to refer to the variable name.

This code is from SmryEachVar v2.

http://www.sascommunity.org/wiki/SmryEachVar_A_Data_Review_Suite

you need 1. new variable: Vname 2. RTFM on vname function

DATA _Null_; if 0 then set &CxData.; attrib Stmnt length = $132 Vname length = $ 32; array Mvar(*) $32 _character_;

do until(EndoFile); set &CxData. end = EndoFile;

do I = 1 to dim(Mvar) -2; call vname(Mvar(I) ,Vname); Stmnt = catx(' ','%let',Vname,'=' ,Mvar(I) ,';'); end; end; stop;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov


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