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

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

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

4 REPLIES 4
SASKiwi
PROC Star

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.

Ksharp
Super User

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;
RodTennant
Calcite | Level 5

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

 

My ODS destination is Powerpoint.

Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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