I want to split a table with many (454) columns in a PROC SQL (perhaps using a macro?) by column names.
For example: a column is starting with "Column21....T", "Column22....T", etc.
I want to write all those columns starting with "Column21...T" to a data set called First, and all the columns starting with "Column22....T" to a data set called Second, etc.
I want to retain the first and second column of the transposed table because they contain the descriptional rows.
I cannot use select column1, column2.... Column454 because of the large number of columns.
How do I do this?
(@Mod: thanks for the clean-up :))
Edit, one picture to say it all:
This is my transposed table with 454 columns
PROC SORT
DATA=work.stat(KEEP=A_ B_ C_ D_ Vx G Vy)
OUT=work.stat2;
BY G;
RUN;
PROC TRANSPOSE DATA=work.stat2
OUT=WORK.x(LABEL="Transposed")
PREFIX=Column
LET
NAME=Source
LABEL=Label;
BY G;
ID Vx;
IDLABEL Vy;
VAR A_ B_ C_ D_;
RUN;