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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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