@PeterClemmensen: @rvsidhu035 already has accepted a solution but, of course, I agree with you. In this case I, personally, would use the macro after running proc transpose to make the dataset long. i.e.:
data new30;
input id $ sysbp diabp;
cards;
001 130 80
002 110 90
003 140 70
004 120 80
005 130 70
;
run;
proc transpose data=new30 out=need;
var sysbp diabp;
by id;
run;
%transpose(data=need, out=want, by=_name_, id=id,
prefix=_, var=col1, use_varname=no, sort=yes)
Requires a lot less code, has a lot less chance of making an error, and should take a lot less time than all of those steps.
Art, CEO, AnalystFinder.com
... View more