BookmarkSubscribeRSS Feed
Chip
Calcite | Level 5


Hi, I have a report I would like to make look a bit nicer in Excel.  It presently lists a varying number of items per person.  So the first person might have 3 lines and the second person 4 lines and the third person 2 lines etc.  In excel, instead of having the persons name show up on each line, you can merge them together and center them.  So the first person still has 3 lines, but the name shows up once and it shows up in the middle of the 3 lines.  Is there a way to do that using PROC Report?

In the attached spreadsheet, the top table is an idea of what I'm producing and the bottom table is what I'd like to produce.

This is the code I'm using to create the colors...

compute nurse_analyst;

if nurse_analyst in (&nurses.) then call define(_row_,"style","style=[background=lightgrey]");

if nurse_analyst = ' ' and _break_ ne "_RBREAK_" then do;

mr_code='Total'; call define(_row_,"style","style=[background=lightblue]"); end;

if nurse_analyst = ' ' and _break_ = "_RBREAK_" then do;

mr_code='Grand Total';  call define(_row_,"style","style=[background=lightred]"); end;

endcomp;

I re-typed this in so there could be typos (sorry in advance) but the actual code does work.

Thanks!

3 REPLIES 3
HoustonGSC
Calcite | Level 5

Are you using Column and Defines?  Defining the column as a group should work.  I have not worked on SAS for quite a while but I looked at an old job setup and it is working as you described.

COLUMN STOOGE TYPE STATE CASETYPE REMAINING;

DEFINE STOOGE / GROUP 'STOOGE';

DEFINE TYPE / ....

DEFINE STATE / ....

DEFINE CASETYPE / ....

DEFINE REMAINING / ....

Chip
Calcite | Level 5

Thanks - I am using column and defines.

Per your recommendation, I tried grouping on stooge but I got a message that other vars were indicated as display and it wouldn't group.  Because of that, I don't think Grouping is exactly what I want because I still need multiple lines per stooge.


Thanks for the thought though!

Cynthia_sas
SAS Super FREQ

Hi:

If you take a look at this blog post, you'll see that the SPANROWS option in PROC REPORT does what you want. You need to use the option on the PROC REPORT statement in order to get the spanning behavior.

http://blogs.sas.com/content/sastraining/2011/02/28/whats-so-great-about-spanrows/

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 1960 views
  • 0 likes
  • 3 in conversation