BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Starting from the following example of PROC REPORT:

data test(keep=state industry income);
set sashelp.prdsale;
State=region;
Industry=prodtype;
Income=actual;
run;
proc report data=TEST;
COLUMN STATE INDUSTRY INCOME ;
DEFINE STATE/display GROUP;
DEFINE industry/display GROUP ;
DEFINE INCOME /ANALYSIS sum;
run;

If I delete the "GROUP" option I get the display of all the rows:

proc report data=TEST;
COLUMN STATE INDUSTRY INCOME ;
DEFINE STATE/display ;
DEFINE industry/display;
DEFINE INCOME /ANALYSIS sum;
run;

I would like to be able to display all the values of "State", without having the multiplication of rows. It's possible?
I would like to get the following report:
State Industry Income
EAST FURNITURE 146471
EAST OFFICE 223790
WEST FURNITURE 144154
WEST OFFICE 215922

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Then you need to compute the sums using PROC SUMMARY, and then format the table to the way you'd like it using PROC REPORT.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

If you want all records collapsed into a group, you need to define the variables as GROUP.

 

proc report data=TEST;
COLUMN STATE INDUSTRY INCOME ;
DEFINE STATE/group ;
DEFINE industry/group;
DEFINE INCOME /ANALYSIS sum;
run;
--
Paige Miller
mariopellegrini
Pyrite | Level 9

It does not solve my request. I would like to see the replication of EAST and WEST displayed.
I would like to get the following report:
State Industry Income
EAST FURNITURE 146471
EAST OFFICE 223790
WEST FURNITURE 144154
WEST OFFICE 215922

PaigeMiller
Diamond | Level 26

Then you need to compute the sums using PROC SUMMARY, and then format the table to the way you'd like it using PROC REPORT.

--
Paige Miller
ssafmed
Obsidian | Level 7

Hello Mario,

 

This procedure solve the problem,

 

PROC REPORT DATA=TEST;
COLUMN STATE INDUSTRY INCOME;
DEFINE STATE/GROUP;
DEFINE industry/GROUP;
DEFINE INCOME /ANALYSIS sum;
COMPUTE STATE;
IF STATE NE "" THEN DUMMY=STATE;
ELSE STATE=DUMMY;
ENDCOMP;
RUN;

 

Regards!