I don't understand why this isn't working. I want to sum up all the Qtrly_Paids for each Paid_Qtr. I know how to do this in proc sql but can't figure out why this isn't working in a data step.
DATA RDS_Final;
RETAIN PAID_QTR QTR_Paids;
SET work.RDS_Qtr_Pds(KEEP=Paid_Qtr Qtr_Paids);
FORMAT
Pd_Clm_From_Rds COMMA20.;
BY Paid_Qtr;
IF first.Paid_Qtr THEN Pd_Clm_From_Rds = 0;
Pd_Clm_From_Rds + Qtr_Paids;
DROP Qtr_Paids;
RUN;
You got most of the way there.
Your result includes all the original observations, with the cumulative total so far.
To subset and get only the final totals, add this statement at the end of the DATA step:
if last.Paid_Qtr;
log message plz
You got most of the way there.
Your result includes all the original observations, with the cumulative total so far.
To subset and get only the final totals, add this statement at the end of the DATA step:
if last.Paid_Qtr;
I really need to look into first. last. and by processing more...
It seems like a simple concept that I'm missing.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.