Hi everyone,
I'm not able to make a summary of columns with proc report (or I can't find the sintax of code sas to make a summry of colomuns) .
for example, I have this data set:
SEX COD VAL1 VAL2
M 1 12 2
F 3 14 2
M 2 12 3
and I would like to create a report like this:
SEX COD VAL1 VAL2 VAL1+VAL2
M 1 12 2 14
2 12 3 15
F 3 14 2 16
is there one way in proc report to summarize the column?
Sure . Easy for proc report.
data have; input SEX $ COD VAL1 VAL2 ; cards; M 1 12 2 F 3 14 2 M 2 12 3 ; run; proc report data=have nowd out=x; column sex cod VAL1 VAL2 var1_var2; define sex/group; define cod/display; define VAL1/display; define VAL2/display; compute var1_var2; var1_var2=sum(VAL1,VAL2); endcomp; run;
Xia Keshan
Look to me just restructure not summary
data have;
input SEX $ COD VAL1 VAL2;
cards;
M 1 12 2
F 3 14 2
M 2 12 3
;
run;
proc sort data=have;
by descending sex Cod;
run;
data want ;
set have;
by descending Sex;
if ~(first.Sex) then Sex="";
TOT=VAL1+VAL2;
run;
Sure . Easy for proc report.
data have; input SEX $ COD VAL1 VAL2 ; cards; M 1 12 2 F 3 14 2 M 2 12 3 ; run; proc report data=have nowd out=x; column sex cod VAL1 VAL2 var1_var2; define sex/group; define cod/display; define VAL1/display; define VAL2/display; compute var1_var2; var1_var2=sum(VAL1,VAL2); endcomp; run;
Xia Keshan
Thank you!!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.