DATA Step, Macro, Functions and more

Indenting Row Headings using Proc Report

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

Indenting Row Headings using Proc Report

Greetings,

 

Is it possible, using PROC REPORT (SAS v9.4), to mimic the capabilities of PROC TABULATE with regard to indenting nested rows underneath parent rows instead of placing them next to each other?

 

For example, I have data that produces output similar to below:

 

---------------------------
|                 |Gender |
|                 |-------|
|EDLVL  OFFICE    | F | M |
|-----------------+---+---|
|Bac    Accounting|  4|  2|
|       Admin     |  2|  3|
|       Systems   |  4|  4|
|Mas    Accounting|  2|  2|
|       Admin     |  1|  0|
|       Systems   |  3|  4|
|PhD    Systems   |  0|  1|
---------------------------

in PROC TABULATE, I can use NOSEPS and INDENT= options to make the above output look like the following:

 

----------------------
|            |Gender |
|            |-------|
|            | F | M |
|------------+---+---|
|Bac         |       |
|  Accounting|  4|  2|
|  Admin     |  2|  3|
|  Systems   |  4|  4|
|Mas         |       |
|  Accounting|  2|  2|
|  Admin     |  1|  0|
|  Systems   |  3|  4|
|PhD         |       |
|  Systems   |  0|  1|
----------------------

Although I am not very savvy in PROC REPORT, I want to use that tool because there is so much more to my product than what's seen here.  Does PROC REPORT have the capability to do this?

 

Any help would be greatly appreciated.

 

Thank you

 

Rod

 


Accepted Solutions
Solution
‎05-25-2016 02:21 PM
Super User
Posts: 9,676

Re: Indenting Row Headings using Proc Report

What is your ODS Destination ?

 

data class;
 set sashelp.class;
 select(age);
 when(11,12) group='xxxxx';
 when(14,15,16) group='yyyyy';
 otherwise group='zzzzz';
 end;
run;

proc report data=class nowd;
column group name age,sex;
define group/group noprint;
define name/display style={pretext='     ' asis=on};
define sex/across;
define age/analysis ' ';
compute before group/style(lines)={just=left fontweight=bold};
 line group $40.;
endcomp;
run;

View solution in original post


All Replies
Super User
Posts: 3,105

Re: Indenting Row Headings using Proc Report

Yes this is possible in PROC REPORT. You do this by creating a COMPUTED column which is defined by a series of REPORT programming statements. It requires some advanced techniques so its a lot easier to follow from an example. I've seen something like this in SAS Support so I'll try to find an example for you.

Solution
‎05-25-2016 02:21 PM
Super User
Posts: 9,676

Re: Indenting Row Headings using Proc Report

What is your ODS Destination ?

 

data class;
 set sashelp.class;
 select(age);
 when(11,12) group='xxxxx';
 when(14,15,16) group='yyyyy';
 otherwise group='zzzzz';
 end;
run;

proc report data=class nowd;
column group name age,sex;
define group/group noprint;
define name/display style={pretext='     ' asis=on};
define sex/across;
define age/analysis ' ';
compute before group/style(lines)={just=left fontweight=bold};
 line group $40.;
endcomp;
run;
Occasional Contributor
Posts: 14

Re: Indenting Row Headings using Proc Report

This worked very well. Thank you for helping...I very much appreciate it.

 

My ODS destination is Powerpoint.

SAS Super FREQ
Posts: 8,743

Re: Indenting Row Headings using Proc Report

Hi:
There have been several previous postings about this. I believe the most recent one showed the use of LEFTMARGIN to accomplish indenting but NOT for the LISTING output. Searching the forum should help you find the posting.

cynthia
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 272 views
  • 0 likes
  • 4 in conversation