Also attached are the following:
* Output showing my data before and after running proc expand on the data is the piece of code that
Typically PROC TIMESERIES is used to fill gaps.
https://gist.github.com/statgeek/07a3708dee1225ceb9d4aa75daab2c52
Thanks Reeza. Your reply gave me a clue.
The answer is to use proc expand with the option method=step to get the previously missing observation to use field values for the last non-missing observation.
Bravo @Bobbe_Stiff! Please post your solution code (using the {i} button) to help future users facing the same problem. You can mark your own solution as the correct answer too.
Here is the code to use PROC TIMEDATA to fill the time ID gaps using the previous values.
data test;
length claim $3 claims_lodgement_date date_of_injury snapshot_date dev_month_lodge dev_month_injury netcostc netpayc 8;
format claims_lodgement_date date_of_injury snapshot_date date9. netcostc netpayc dollar10. ;
format dev_month_lodge dev_month_injury 3.;
informat claims_lodgement_date date_of_injury snapshot_date date9.;
infile datalines delimiter=',' dsd;
input claim claims_lodgement_date date_of_injury snapshot_date dev_month_lodge dev_month_injury netcostc netpayc ;
put _all_;
datalines;
XYZ,01FEB1994,21JUL1993,28FEB1994,0,7,80,80
XYZ,01FEB1994,21JUL1993,30APR1994,2,9,3961,3961
;
run;
proc timedata data=test out=step11;
by claim;
var claims_lodgement_date date_of_injury Dev_Month_Lodge Dev_Month_Injury netcostc netpayc;
id snapshot_date interval = month setmissing = prev;
run;
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 16. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.