BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am using Proc report to create an Excel file using ODS. There is a variable called Division that I sub-total on but have now been asked to added a more descriptive name such as: Sub-Totals for Division = North and East (where North & East is the division name) and changes for each value of division in the file. I assume there is a way to create a macro for this but am not sure how to do this. Any help would be appreciated.
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
I'm don't think that you need a Macro variable or macro program for this task.

PROC REPORT allows you to assign a text string to a report column at the break with a COMPUTE AFTER block...
[pre]
break after division / summarize;
compute after division;
division= 'SubTotal for '||trim(division);
endcomp;
[/pre]

Assuming that the length of the Division variable was long enough for the whole text string (including the spaces), then you would get the customized text at the break. Of course, if Division is only 15 characters in length, then the string 'SubTotal for ' is going to take up 13 characters -- so you'd have to use some other techniques to get your customized break text. It is all still possible with PROC REPORT without using macro variables.

Reading the PROC REPORT documentation and examples or contacting Tech Support would be your best bet for help with this task if you are not familiar with PROC REPORT COMPUTE blocks.

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
  • 1 reply
  • 687 views
  • 0 likes
  • 2 in conversation