@udden2903 wrote:
Would you mind quickly explaining what your code does? I'm new to macros and I think gaining some understanding of your code would be helpful as I start learning more about them.
1 %let locf=patientid diag:;
2 data patients;
3 if 0 then set patients;
4 update patients(obs=0 keep=&locf) patients(keep=&locf);
5 by patientid;
6 set patients(drop=&locf);
7 output;
8 run;
There is really no MACRO here just the macro variable (symbolic variable) LOCF
How would you modify this code to make sure that the dummy values from the previous observation continue into the current observation ONLY if the current observation has missing values for ALL of the dummy variables? Right now, the value of a dummy variable is carried forward as long as the value of that variable is missing in the next observation, without any consideration of the values of the other dummy variables.
Be careful. John King's code would work only if year don't have any missing value .
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.