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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 443 views
  • 0 likes
  • 2 in conversation