Hi ! I need to create several datasets with a SAS’s Macro but I could not do it. I have a dataset with “I” variables group by variable “j” and i get many statistics for each one with Proc Means. At the end, I have for each variable j value, i datasets with one variable and one observation, like this : J=1 Dataset 1,1 Dataset 1,2 Dataset 1,3 …. Dataset 1,i Mean_11 Mean_12 Mean_13 Mean_1i 5,5 8 45 12 J=2 Dataset 2,1 Dataset 2,2 …. Dataset 2,i Mean_21 Mean_22 Mean_23 Mean_2i 87 85 4 65 ... ... J=j Dataset j,1 Dataset j,2 …. Dataset j,i Mean_j1 Mean_j2 Mean_ji 15 5 23 I need to create only one table with all of one variable’s datasets for each j value group. Something like that : Dataset j=1, Mean_11 Mean_12 Mean_13 Mean_1i 5,5 8 45 12 I tried that but it do not work: %let j=1 ;
%macro all;
data test_t&j ;
set
%do i=1 %to 10 ;
mean_&j&i sum_&j&i
%end ;
run ;
%mend ;
%all; Could somebody help me please to find where I have wrong ? There is a way to do a DO loop for the value of j to avoid making a macro for each value of j ? Thank you very much !
... View more