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:         Thu, 31 Aug 2006 04:04:09 -0700
Reply-To:     Arjen <a.benedictus@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arjen <a.benedictus@GMAIL.COM>
Organization: http://groups.google.com
Subject:      resolve macro variable within do-loop?
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset="iso-8859-1"

Hello all,

Yesterday I posted a question about replacing character variables by numeric ones in order to sort them in a specific way. I received some good answers. Now, I want to sort multiple character variables in one data set. In order to obtain a code that is as generic as possible, I (i) coded my variables as macro variables, (ii) set the format and then (iii) try to assign the numeric values to the character values through a do-loop. But I cannot manage to resolve the macro-variable in the array. Any help? Thanks! Arjen

%LET d1 = VirusOne; %LET d2 = VirusTwo; %LET d3 = VirusThree;

data have; input &d1 $ &d2 $ &d3 $ @@; cards; u p n n u u n p p u n p p u u u n n n n p p u u u n p n u p n p u ; run;

proc format ; invalue result 'p' = 1 'n' = 2 'u' = 3 other = . ; run;

data have2; set have; array d[1:3] d1-d3; do i = 1 to 3; &d[i] = input (&d[i], result.); end; run; proc print; run;


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