BookmarkSubscribeRSS Feed
jteague
Calcite | Level 5

I am using macros because I am using a lot of years and different variables. &yr.=year &var.=Program_type. i attached what it produces. I also want another row below it with totals for cohort column and retention rates for entire program should look like this:

total:59668.27200078.74

 

proc report data = cretention&yr.&var. split='\';
column Instruction_Method &var.,(count Retention_rate);
define Instruction_method / group "Fall Instruction Method" width=8;
define &var. / across "&var.";
define Count / 'Cohort';
define Retention_rate/ 'Retention Rate';
title "Fall &yr. to Spring Retention Rate by Fall Instruction Method and &var.";
run;

 

thanks

1 REPLY 1
ballardw
Super User

Cannot test code without data.

Cannot test code with macro variables without knowing what the values of the macro variables are.

 

The very first example for Proc Report in the online help shows how to add a summary line at the end of a report.

However anything called a "rate" is very likely not going to get a valid summary that way as the default summary is a SUM and Across variables complicate such. Rates typically need a numerator and denominator plus any other formula bits and to do a combined rate have to combine the individual numerators. Typical example: drive 1,000 miles and get a mileage rate of 1mpg, drive 1 mile and get 100mpg (lots of costing downhill perhaps) the average rate is not going to be (1+100)/2=50.5mpg.

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