@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 .
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: