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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 798 views
  • 0 likes
  • 2 in conversation