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: | 596 | 68.27 | 2000 | 78.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
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.