BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

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
2 REPLIES 2
Ksharp
Super User
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;
PaigeMiller
Diamond | Level 26

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?

 

 

 

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 702 views
  • 4 likes
  • 3 in conversation