BookmarkSubscribeRSS Feed
bretthouston
Obsidian | Level 7

Hello,

 

I have what is likely a relatively simple question, but I haven't been able to find the answer for this on prior posts. 

 

Using proc psmatch, my understanding is that categorical variables need to either be collapsed into a binary variable, or dummy variables need to be created. If I have an ordinal variable (THAanesth - with categories 1-5), and I create 5 dummy variables (anesth1 - anesth5), how do I code this within psmatch? Do I include n-1 dummy variables in both the class and psmodel statement? 

For example (THAanesth was previously an ordinal variable 1-5, which has been split into 5 dummy variables):

 

proc psmatch data=THAtable2 region=cs(extend=0);
class TXAstatus sex admitCategory anesth2 anesth3 anesth4 anesth5  ;
psmodel TXAstatus(Treated='1')= age sex admitCategory preopHb anesth2 anesth3 anesth4 anesth5;

match method=greedy(k=1) stat=lps caliper=.;
assess lps var=(age sex admitCategory preopHb anesth2 anesth3 anesth4 anesth5 ) / plots=(boxplot barchart) weight=none;
output out(obs=match)=psmatch1 lps=_Lps matchid=_MatchID;
run;

 

Thanks in advance,
Brett

3 REPLIES 3
Reeza
Super User

 


@bretthouston wrote:

If I have an ordinal variable (THAanesth - with categories 1-5), and I create 5 dummy variables (anesth1 - anesth5), how do I code this within psmatch? Do I include n-1 dummy variables in both the class and psmodel statement? 

 


Depending on the ordinal variable, I would consider treating it as continuous as then you can also consider nearby values. If you don't want that, and want only exact matches for your ordinal variable then keep it as a categorical variable and dummy code it. 

 

You include the dummy variables in both your CLASS and PSMODEL statement.

 

SteveDenham
Jade | Level 19

And if you have a lot of categorical variables, especially with differing levels per variable, consider using PROC GLMMOD to do the dummy coding.

 

SteveDenham

MichaelL_SAS
SAS Employee

Maybe one point to clarify, ordinal variables are not supported in the ASSESS statement in PROC PSMATCH (since many of the balance diagnostics consider mean differences), but they can be used in the other statements. In your example you could use the variable THAanesth in the PSMODEL statement and the binary level indicators you created could be used in the ASSESS statement. However in that case assessing the balance achieved for the variable THAanesth requires judging the balance achieved for all of the binary level indicators. Another option for assessing the balance for a categorical variable is to create an output data set of the matched data and then use PROC FREQ to request a contingency table of the variable and the treatment. That approach is illustrated in Example 1 of this recent SAS Global Forum paper. 

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 3 replies
  • 1313 views
  • 6 likes
  • 4 in conversation