Hi All, I have a data set name A which contains the following columns: ID, F1C1, F1C2, F1C3, F2C1, F2C2,F2C3 ID F1C1 F1C2 F1C3 F2C1 F2C2 F2C3 1 1.1 1.2 1.3 2.1 2.2 2.3 2 1.15 1.25 1.35 2.15 2.25 2.35 3 2.15 2.25 2.35 3 4 5 I want to create a new set B which contains ID, y which is the FxCx value, and along with the levels of F and C(that's the number followng F and C in the column name in A), there should be totally 3*2*3=18 records in my new dataset, that's ID Y F C 101 1.1 1 1 101 1.2 1 2 101 1.3 1 3 101 2.1 2 1 101 2.2 2 2 101 2.3 2 3 201 1.15 1 1 201 1.25 1 2 ..... 301 3 2 1 301 4 2 2 301 5 2 3 I tried using macro to do it, but failed %macro change; data B; set A; %do k=1 %to 3; %do F=1 %to 2; %do C=1 to % 3; y=F&FC&C; output; %end; %end; %end; %mend; %change; It seems there are a few problems with the above code. I cann't get F1C1, F1C2 by using F&FC&C, I can't output the F,C either. Also, I guess there should be solutions without using macro. I will appreciate any kind of help. Thanks! Ning
... View more