BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GreenTree1
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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


 

 

View solution in original post

6 REPLIES 6
Reeza
Super User

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


 

 

GreenTree1
Obsidian | Level 7

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.

Reeza
Super User
They go in both statements, CLASS statement defines the role of the variable, MODEL statement is what should get modeled. IMO you shouldn't have variables in your CLASS statement and not your MODEL statement.
GreenTree1
Obsidian | Level 7
yes makes sense. Thank you once again
FreelanceReinh
Jade | Level 19

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.)

GreenTree1
Obsidian | Level 7
oops, new to this community. I just fixed it.

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 6 replies
  • 1932 views
  • 2 likes
  • 3 in conversation