Date: Fri, 26 Mar 2010 15:15:25 -0400
Reply-To: Bill Krause <wkrause2003@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Bill Krause <wkrause2003@YAHOO.COM>
Subject: Changing formats on Transpose dataset
I am using Proc Transpose to convert a vertical table called test.
In the vertical table under a column called mrv is a list of variable
names. In the column called infmt is the format for the mrv response value.
The original table(test) has a format for the response value set to $500.
**** create vertical table ;
data test;
infile datalines truncover;
input suid :$2. mrv :$32. Response :$500. infmt $char42.;
mrv= upcase(mrv);
infmt = strip(infmt);
datalines;
1 HH1 1 1.
1 HH2 22 7.2
1 SC1 Yes $char25.
2 HH1 5 1.
2 HH2 10 7.2.
2 SC1 No $char25.
;
run ;
**** convert the vertical table to a horizontal table ;
proc transpose data=test out=testpose (drop=_label_ _name_ ) ;
by suid ;
id=mrv ;
var=response ;
run ;
So file(testpose) will look like:
suid HH1 HH2 SC1
1 1 22 Yes
2 5 10 No
What I need to change the informat/format on the TRANSPOSED file for the
REPLY from $500. to the respective informat/format given in the infmt.
The format of the horizontal table should be :
It should be:
HH1 1.
HH2 7.2
SC1 $char25.
Instead of:
HH1 $500.
HH2 $500.
SC1 $500.
Thanks for your assistance.
Bill K.
wkrause2003@yahoo.com