I've got a wide dataset with each month listed as a column. I'd like to transpose the data to a long format, but the problem is that my column names will be changing in the future. What's the best way to transpose with a dynamic variable being passed to the transpose statement?
For example:
data have;
input subject $ "Jan-10"n $ "Feb-10"n $ "Mar-10"n $;
datalines;
1 12 18 22
2 13 19 23
;
run;
data want;
input subject month $ value;
datalines;
1 Jan-10 12
1 Feb-10 18
1 Mar-10 22
2 Jan-10 13
2 Feb-10 19
2 Mar-10 23
;
run;