BookmarkSubscribeRSS Feed
UcheOkoro
Lapis Lazuli | Level 10

Hello, 

 

Please, I need some help with PS match. I tried matching a dataset using psmatch but got no matches. However, I used R and got matches.The variables are the same and size of caliper.

I sincerely cannot tell why it is so.

The following are my SAS codes.

ods graphics on;
proc psmatch data=Data10f region=cs;
class telemed_use sex Age2 bmi2 triage_pulse2 total_sofa1_ed mode_arrival pmh_copd pmh_cirrhosis pmh_transplant 
                     pmh_cancer pmh_diabetes pmh_dialysis infection_ed_source2 Lactate1_cat firsted_hosp2;
psmodel telemed_use(Treated='1')=  sex Age2 bmi2 triage_pulse2 triage_systolic total_sofa1_ed mode_arrival pmh_copd pmh_cirrhosis pmh_transplant 
                                     pmh_cancer pmh_diabetes pmh_dialysis infection_ed_source2 Lactate1_cat firsted_hosp2;
match method=optimal(k=1) exact=sex stat=ps caliper=0.25;
assess ps var=( sex Age2 bmi2 triage_pulse2 triage_systolic total_sofa1_ed mode_arrival pmh_copd pmh_cirrhosis pmh_transplant 
                                     pmh_cancer pmh_diabetes pmh_dialysis infection_ed_source2 Lactate1_cat firsted_hosp2) / weight=none plots=(boxplot barchart);
output out(obs=match)=Outgs ps=_ps matchid=_MatchID;
run;
proc sort data=outgs out=Avera_matched_data;by _ps;run;

The following is the log output I got.

UcheOkoro_0-1607453386486.png

Thank you

7 REPLIES 7
Reeza
Super User
Can you resolve some of those warnings? Is your data structured appropriately for PSMATCH?
UcheOkoro
Lapis Lazuli | Level 10

The warning is saying that the variables in the class statement are not binary. I do not want to make them binary variables. I took the variables out of the class statement , then I got no more warnings but still got no matches.

Does this imply that if the categorical variables are not binary, there won't be matches?

UcheOkoro_0-1607454700188.png

 

Reeza
Super User
Variables in the ASSESS statement must be binary or continuous it seems.
VAR=(var-list)
requests an assessment of differences in the specified list of variables. These variables must be binary classification variables or continuous variables in the input data set. These variables can be the variables not specified in the PSMODEL statement.

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=statug&docsetTarget=statu...

Personally, I would start with a known example, get the results to work in both SAS and R and then replicate what you need for your actual data. That being said, the methodologies will match but the actual samples/comparisons created may not match at all depending on your data and the criterion used.

UcheOkoro
Lapis Lazuli | Level 10

Thank you so much for taking time to respond to my question.

 

I took out the non binary categorical variables and still got no matches. I started by adding variables one by one and running PS match. Taking out those that produced on matches. I noticed that even with some binary variables there were no matches which is strange.

SteveDenham
Jade | Level 19

What happens if you increase the value for 'caliper' in the MATCH statement?  It may be that the criterion is too stringent with this many variables (16, I think) to match on. I guess the most surprising thing to me is that the R package did give results with this caliper value.  Check the R documentation for the definition of caliper in that package to be sure that the same definition is being applied as in PSMATCH.

 

SteveDenham

UcheOkoro
Lapis Lazuli | Level 10

Increasing the caliper in the match statement  in SAS makes no difference. I still do not have matches.  I also noticed that optimal matching in R ignores the caliper statement. 

Reeza
Super User
I would start with a known example, get the results to work in both SAS and R and then replicate what you need for your actual data. The documentation for SAS in PSMATCH includes a few data sets you can import those into R and test them there to see the difference.

Can you also provide your R code? Are you certain you're R code is correct?

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
  • 7 replies
  • 992 views
  • 1 like
  • 3 in conversation