BookmarkSubscribeRSS Feed
SG1993
Fluorite | Level 6

Hi, 

 

I am running the following code and am getting the error that "The variable Gender in the STAT=MAH option is in the class list". 

proc psmatch data=drugs region=cs;

   class Drug Gender;

   psmodel Drug(Treated='Drug_X')= Gender Age BMI;

   match method=greedy(k=1) 

         distance=mah(lps var=(Age BMI Gender)) caliper=0.2

         stat = lps

         weight=none;

   assess lps var=(Gender Age BMI);

   output out(obs=match)=OutEx7 matchid=_MatchID;

run;

 

I wanted to see of there was a way to include categorical variables in the Mahalanobis distance calculation in the above procedure. Any suggestion would be really appreciated. 

 

Thanks! 

1 REPLY 1
mkeintz
PROC Star

If GENDER were taken out of the CLASS statement, and if gender were coded as, say 0 and 1, wouldn't it then serve your purpose?  I believe that's all you would need to account for the confounding of GENDER with AGE & BMI in assignment of DRUG.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 1 reply
  • 362 views
  • 0 likes
  • 2 in conversation