Hello
The question is about proc report
data tbl1;
input ID t $ X Y;
cards;
1 a 10 200
2 a 20 200
3 b 30 200
4 b 40 200
5 c 50 200
6 d 50 200
;
run;
/*Desired output by using proc report*/
a 30 30/200
b 70 70/200
c 100 100/200
Total 200 empty cel
data tbl1;
input ID t $ X Y;
cards;
1 a 10 200
2 a 20 200
3 b 30 200
4 b 40 200
5 c 50 200
6 d 50 200
;
run;
proc report data=tbl1 nowd;
column t y x z;
define t/group;
define y/group noprint;
define x/analysis sum;
define z/computed;
compute z/character length=20;
z=catx('/',x.sum,y);
endcomp;
compute after ;
t='total';z=' ';
endcomp;
rbreak after/summarize;
run;
So, it helps when you provide examples that cover a range of situations. In your data, is Y always equal to 200, or can it take on other values?
Why does your output data set not contain D?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.