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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: