Hi community,
I’m learning MSM model and find a helpful paper published by SAS: https://support.sas.com/content/dam/SAS/support/en/books/analysis-of-observational-health-care-data-...
I was not able to follow the piece of code below on page 16:
DATA WEIGHTS;
merge weights predtrt predcen;
By patsc vis;
VWT=Predtrt*predcen;
If first.patsc then stabwt=VWT;
Else stabwt=VWT*DUM;
Retain DUM;
DROP DUM;
DUM=STABWT;
run;
how was DUM defined here?
The variable DUM has the same the value as STABWT when the RUN statement is encountered. But the DROP statement keeps it out of the WEIGHTS dataset.
However, DUM is retained, meaning each observation starts out with the value in DUM generated in the preceding observation.
So when the "else stabwt=vwt*dum;" statement is executed, it is actually calculating stabwt as the product of VWT from the current observation and STABWT from the prior observation. EXCEPT when the current obs is the beginning of a new patsc group, when the "stabwt=VWT;" statement is executed.
In other words, STABWT=VWT*lag(STABWT) except when starting a new patsc.
The variable DUM has the same the value as STABWT when the RUN statement is encountered. But the DROP statement keeps it out of the WEIGHTS dataset.
However, DUM is retained, meaning each observation starts out with the value in DUM generated in the preceding observation.
So when the "else stabwt=vwt*dum;" statement is executed, it is actually calculating stabwt as the product of VWT from the current observation and STABWT from the prior observation. EXCEPT when the current obs is the beginning of a new patsc group, when the "stabwt=VWT;" statement is executed.
In other words, STABWT=VWT*lag(STABWT) except when starting a new patsc.
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!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.