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.
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!
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.