I have a very large data set (18 million observations) that I would like to transpose by subsetting based on one variable and creating 900 new variables out of those sub/ets. Ex
Transpose steps like this are easily done with the array
statement. Example for your code would be something like:
data new (keep = year var1-var3);
set data;
by year;
array vars {3} var1-var3;
retain var1-var3;
if first.year then i=1;
else i+1;
vars{i} = faminc;
if last.year then output;
run;
But I don't have SAS to double check this. Also see here.
There are no good transpose procedures in PROC SQL.Too limited.