It seems that you have two pieces of data in each variable name: The
variable and a time.
You have many variables and many times per variable. You want to take a
dataset with a DV like
A0B, A10B, A20B, C0B, C10B, C20B, ....
x11, x12, x13, y11, y12, y13, ...
x21, x22, x23, y21, y22, y23, ...
And turn it into
Time AB CB ...
0 x11 y11
10 x12 y12
20 x13 y13
0 x21 y21
10 x22 y22
20 x23 y23...
Puddin' Man has part of the answer, here is the rest...
INPUT A0B A10B A20B B0C B10C B20C ;
1 2 3 4 5 6
7 8 9 10 11 12
* GET VARIABLE LIST INTO A MACRO VARIABLE TO MAKE LIFE EASIER;
SELECT Name INTO :mvInputVarList SEPARATED BY " "
FROM DICTIONARY.COLUMNS WHERE MemName='TEST' ORDER BY Name;
* READ THE DATA AND ASSIGN IT TO THE RIGHT OUTPUT COLUMN ;
LENGTH REC Time 8 VarName $32 Data 8;
DROP &mvInputVarList ;
ARRAY aInputVars &mvInputVarList ;
* ITERATE THROUGH INPUT VARS TO GET VALUES ;
DO OVER aInputVars ;
Data = aInputVars ;
* SORT THE DATA JUST IN CASE ;
PROC SORT DATA=FIX OUT=FIX2;
BY Rec Time VarName;
* TRANSPOSE THE DATA INTO THE FORM DESIRED ;
PROC TRANSPOSE DATA=FIX2 OUT=RESULT (DROP=_NAME_);
BY Rec Time;
Andrew James Llwellyn Cary
Reden & Anders, Ltd
"William Kossack" <email@example.com> wrote in message
> I've been given another wonderfully large sas dataset with variables
> ABCD0_xyz, ABCD10_xyz, ABCD20_xyz, ABCD30_xyz, etc etc
> the problem is that the number in the middle is an important piece of
> information that I need to break out into the real dataset so I get
> something like this
> ABCD_xyz time
> 1 0
> 2.2 10
> 3333 20
> 787 30
> this would be easy except for the large number of variables that have
> been coded this way.
> any suggestions?