BookmarkSubscribeRSS Feed
sasphd
Lapis Lazuli | Level 10

Hello, 

I want to condunct PSMATCH to have the matched sets of id which correspond to the treatment group. 

I want your help to understand Example 96.4 Greedy Nearest Neighbor Matching https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/statug/statug_psmatch_examples04.htm 

sasphd_0-1640011820553.png

column match_id is supposed to give the id of matched group so  why I did not see sudentID in this column???

10 REPLIES 10
Tom
Super User Tom
Super User

Doesn't that report mean that StudentIDs 156 and 173 form the first match?

sasphd
Lapis Lazuli | Level 10

so why I did not find the same thing using my data and program ?

 

 

proc psmatch data=man.pms_data region=treated;

   class IPO ;

   psmodel IPO(Treated='yes')= age Net_asset_share_class Expenses Turnover manger_tenure_average count_name flux;

   match distance=lps method=greedy(k=1)  caliper=0.5;

   assess lps var=( age Net_asset_share_class Expenses Turnover manger_tenure_average count_name flux)

          / stddev=pooled(allobs=no) stdbinvar=no

             weight=none;

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

run;

 

this is my OUTEX4

sasphd_0-1640014673090.png

 

maguiremq
SAS Super FREQ
Are those all the variables in your data set? It's hard for us to tell from a screenshot. Maybe run a PROC CONTENTS just to show the variables so we can be certain it's not actually in your data set.
sasphd
Lapis Lazuli | Level 10

yes this is all my variable by not all the data. this is a screenshot of proc contents 

sasphd_1-1640015945584.png

 

 

sasphd_0-1640015876758.png

 

maguiremq
SAS Super FREQ

Thanks, but this appears to be your original data set. What about `OutEx4`? Can you show me that one?

 

With this statement:

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

you are creating a new data set, `OutEx4`. That should have _matchID.

sasphd
Lapis Lazuli | Level 10

thanks for your help

the outExt give the matched Id. when I make a proc sort by _MatchID I find the same table as Output 96.4.14: Output Data Set with Matching Numbers

however I find that the program match each observation for  the treatment group  with only one observation in  the control group 

 

but I want to match each observation for  the treatment group  with multiple observations in the control group if the PMS score allow. 

can you help me to have the good procedure for that ?

 

Reeza
Super User

@sasphd wrote:

thanks for your help

the outExt give the matched Id. when I make a proc sort by _MatchID I find the same table as Output 96.4.14: Output Data Set with Matching Numbers

however I find that the program match each observation for  the treatment group  with only one observation in  the control group 

 

but I want to match each observation for  the treatment group  with multiple observations in the control group if the PMS score allow. 

can you help me to have the good procedure for that ?

 


You specified K=1 in your code, which means it matches 1:1. 

To match at a different ratio you would specify a different k.

 

proc psmatch data=man.pms_data region=treated;

   class IPO ;

   psmodel IPO(Treated='yes')= age Net_asset_share_class Expenses Turnover manger_tenure_average count_name flux;

   match distance=lps method=greedy(k=1)  caliper=0.5;

   assess lps var=( age Net_asset_share_class Expenses Turnover manger_tenure_average count_name flux)

          / stddev=pooled(allobs=no) stdbinvar=no

             weight=none;

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

run;

 

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_psmatch_syntax08.htm#statug.psm...

 

 

METHOD=GREEDY <(K=k ORDER=order-option)>

requests greedy nearest neighbor matching, in which each treated unit is sequentially matched with the k nearest control units. Matching depends on the ordering of the treated units, which you can specify in the ORDER= suboption.

You can specify the following suboptions:

K=k

specifies the number of matching control units, where k > 0, for each treated unit. PROC PSMATCH performs k separate loops of matching for treated units. In each loop, the nearest control unit is sequentially matched to each treated unit. By default, K=1 (one control unit for each treated unit).

 

 

sasphd
Lapis Lazuli | Level 10

thanks for the response. 

I wonder if there is a method in proc psmatch that give the optimal matching of control group?

Reeza
Super User
AFAIK matching is based on your experimental design not an optimization.
maguiremq
SAS Super FREQ

I've never used the PSMATCH procedure, but @Tom seems to be right. I looked up the user guide and it seemed to go along with that idea.

 

https://support.sas.com/documentation/onlinedoc/stat/142/psmatch.pdf

 

Page 7687

 

and the MATCHID=_MatchID
option creates a variable named _MatchID that identifies the matched sets of observations.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 1193 views
  • 4 likes
  • 4 in conversation