A simple example:
data wide;
input id $ aug12 sep12 oct12;
label
aug12 = "201208"
sep12 = "201209"
oct12 = "201210"
;
datalines;
A 1 2 3
;
proc transpose data=wide out=trans (rename=(col1=value));
by id;
var aug12--oct12;
run;
data long;
set trans;
period = input(_label_,yymmn6.);
format period monyy5.;
drop _name_ _label_;
run;
With this vastly improved dataset layout, the code is now very simple:
proc report data=long;
column id value,period;
define id / group;
define value / "" analysis;
define period / "" across order=data;
run;
Result:
id AUG12 SEP12 OCT12
A 1 2 3
By changing the format for the ACROSS variable in PROC REPORT, you can get anything you like, without having to resort to macro programming or CALL EXECUTE steps.
... View more