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

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