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 (August 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 30 Aug 2006 09:44:38 -0400
Reply-To:   Xu Libin <Libin.Xu@IRS.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Xu Libin <Libin.Xu@IRS.GOV>
Subject:   Can we use a macro variable as the Array Name?
In-Reply-To:   A<000801c6cb6b$2ca86350$85f929f0$@net>
Content-Type:   text/plain; charset="US-ASCII"

Thanks to the input from several Toby, David, Ed, Jack, and others, I put together the program below to create multiple variables from one variable using array statement and some macro. I have four such variables to process. Is there a way to substitute the array name with a macro name so that I can use one set of commands instead of four? When I checked the online SAS help files, I was not able to find information concerning both array and macro.

Libin

%let varnam=Q26; proc sql; select length into :varlen from dictionary.columns where libname='WORK' and memname='TAB1' and Upcase(name)="&varnam"; %put variable name: &varnam variable length= &varlen; quit; data tabq26 ( Drop = I ); set tab1; Array Q26_(&varlen) ; Do I = 1 to &varlen; If Not (Verify(Strip(Put(I , 8. -L)) , &varnam)) Then Do ; Q26_(I) = 1 ; End ; Else Do ; Q26_(I) = 0 ; End; End; Run;


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