I am trying to understand the PSM code here, can someone please explain what variables are to be included in the class statement?
This is from the SAS documentation and the only explanation is given here and elsewhere for the class is "The CLASS statement specifies the classification variables"
here is the code.
ods graphics on; proc psmatch data=drugs region=cs; class Drug Gender; psmodel Drug(Treated='Drug_X')= Gender Age BMI; match method=optimal(k=1) exact=Gender distance=lps caliper=0.25 weight=none; assess lps allcov / plots=(barchart boxplot); output out(obs=match)=Outgs lps=_Lps matchid=_MatchID; run;
Thank you
CLASS variables are just that, categorical variables. For example, if you have a categorical variable Gender, which will have M/F/Other then you can put that in the CLASS statement. If your variable is continuous do not place it in the CLASS statement. It tells SAS to create dummy variables and treat them as categorical so you don't have to do that manually.
@GreenTree1 wrote:
I am trying to understand the PSM code here, can someone please explain what variables are to be included in the class statement?
This is from the SAS documentation and the only explanation is given here and elsewhere for the class is "The CLASS statement specifies the classification variables"
here is the code.
ods graphics on; proc psmatch data=drugs region=cs; class Drug Gender; psmodel Drug(Treated='Drug_X')= Gender Age BMI; match method=optimal(k=1) exact=Gender distance=lps caliper=0.25 weight=none; assess lps allcov / plots=(barchart boxplot); output out(obs=match)=Outgs lps=_Lps matchid=_MatchID; run;
Thank you
CLASS variables are just that, categorical variables. For example, if you have a categorical variable Gender, which will have M/F/Other then you can put that in the CLASS statement. If your variable is continuous do not place it in the CLASS statement. It tells SAS to create dummy variables and treat them as categorical so you don't have to do that manually.
@GreenTree1 wrote:
I am trying to understand the PSM code here, can someone please explain what variables are to be included in the class statement?
This is from the SAS documentation and the only explanation is given here and elsewhere for the class is "The CLASS statement specifies the classification variables"
here is the code.
ods graphics on; proc psmatch data=drugs region=cs; class Drug Gender; psmodel Drug(Treated='Drug_X')= Gender Age BMI; match method=optimal(k=1) exact=Gender distance=lps caliper=0.25 weight=none; assess lps allcov / plots=(barchart boxplot); output out(obs=match)=Outgs lps=_Lps matchid=_MatchID; run;
Thank you
Thank you so much Reeza. It's much clear now.
The confounders in my dataset are all binary variables, should I still have them in class and model as well? or skip the class statement and have them in the model statement only.
Hello @GreenTree1,
Glad to see that Reeza's reply answered your question. Then it would be fair and help later readers if you marked her reply as the accepted solution, not your own "thank you" post. Could you please change that? It's very easy: see instructions here, if needed: https://communities.sas.com/t5/SAS-Programming/how-to-find-the-difference-between-two-hex-data/m-p/5...
(@Reeza: Another case in point for Make it harder to mark an own post as the solution.)
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.