Date: Fri, 1 Sep 2006 05:39:30 -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: proc informat/ proc format?
Content-Type: text/plain; charset="iso-8859-1"
Hello SAS-L,
Yesterday I posted a question to which a proc informat-solution proved
to be a good answer. Today I decided that I will be able to cut a lot
of code when I do it the other way round, that is, to start with
numeric values and transform them into character variables later on.
Hence the question: I want to convert these numerical variables into
character variables using proc format, but I get an error saying
"invalid numeric data". Any suggestions? (tested code below)
Thanks!
Arjen
%LET d1 = VirusOne;
%LET d2 = VirusTwo;
%LET d3 = VirusThree;
data have;
input &d1 &d2 &d3 @@;
cards;
1 2 2 2 2 3 2 1 1 3
3 1 3 2 2 1 2 1 2 1
1 1 2 2 2 3 2 3 2 2
;
run;
proc format ;
value result
1= "p"
2= "n"
3= "u"
other = .
;
run;
data have2 (DROP=I);
set have;
array nn [1:3] &D1 &D2 &D3;
array zz [1:3] z&D1 z&D2 z&D3;
do i = 1 to 3;
zz[i] = put (nn[i], result.);
end;
run;
|