Hello all,
I wrote the code for Matching with Replacement as in the following Example 98.6 from the SAS User's Guide:
proc psmatch data=School region=allobs(psmin=0.05);
class Music Gender;
psmodel Music(Treated='Yes')= Gender Absence;
match method=replace(k=1) distance=ps exact=Gender caliper=.
nmatchmost=6;
assess ps var=(Gender Absence);
output out(obs=match)=outex6 matchid=_MatchID;
run;
and I get the error message:
ERROR: The support region does not exist.
I try to change the region to psmin=0.01 or psmin=0.001 but I keep getting the same error message.
Could anyone please advise what I'm doing wrong?
Thanks.
Lior
It ran fine when I created the school dataset using the code referenced in the example. see here
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_code_psmchex4.htm
Hi,
In my data, it didn't work...
I thought that if I reduce the "psmin" to be close to zero, I should avoid this error message, but it didn't work...
when I use a different type of matching: "Greedy Nearest Neighbor Matching" it works fine. so I believe there is no problem with my data, but maybe I don't understand how code works.
Thanks,
Lior
I ran your code after creating the school dataset from the example and did not get any errors
data School;
Music= 'Yes';
do j=1 to 60;
if (ranuni(1312) > 0.4) then Gender='Female';
else Gender='Male';
Absence = ranexp(99);
if (Absence < 0.5) then GPA= 4 + rannor(99)/3.5;
else GPA= 4 - abs(rannor(99)/3.5);
if (Gender='Female') then GPA= GPA + 0.02;
id1= ranuni(99);
id2= ranuni(99);
output;
end;
Music= 'No';
do j=1 to 100;
Absence= ranexp(99);
if (ranuni(99) > 0.45) then Gender='Female';
else Gender='Male';
if (Absence < 0.5) then GPA= 4 + rannor(99)/4.2;
else GPA= 4 - abs(rannor(99)/4.2);
id1= ranuni(99);
id2= ranuni(99);
output;
end;
do j=1 to 40;
Absence= 2 + ranexp(99);
if (ranuni(99) > 0.5) then Gender='Female';
else Gender='Male';
GPA= 3.4 - abs(rannor(99)/4.2);
id1= ranuni(99);
id2= ranuni(99);
output;
end;
run;
proc sort data=school;
by id1;
run;
data school;
set school;
StudentID= _n_;
Absence= int(Absence*100+0.5) / 100;
GPA= int(GPA*100+0.5) / 100;
run;
proc sort data=school;
by id2;
run;
proc print data=School(obs=10);
var StudentID Music Gender Absence;
run;
proc psmatch data=School region=allobs(psmin=0.05);
class Music Gender;
psmodel Music(Treated='Yes')= Gender Absence;
match method=replace(k=1) distance=ps exact=Gender caliper=.
nmatchmost=6;
assess ps var=(Gender Absence);
output out(obs=match)=outex6 matchid=_MatchID;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.