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>
Subject: resolve macro variable within do-loop?
Content-Type: text/plain; charset="iso-8859-1"
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?
%LET d1 = VirusOne;
%LET d2 = VirusTwo;
%LET d3 = VirusThree;
input &d1 $ &d2 $ &d3 $ @@;
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
proc format ;
'p' = 1
'n' = 2
'u' = 3
other = .
array d[1:3] d1-d3;
do i = 1 to 3;
&d[i] = input (&d[i], result.);