BookmarkSubscribeRSS Feed
lioradam
Obsidian | Level 7

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

3 REPLIES 3
ghosh
Barite | Level 11

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

lioradam
Obsidian | Level 7

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

 

ghosh
Barite | Level 11

I ran your code after creating the school dataset from the example and did not get any errors


ghosh_0-1662825726201.png
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-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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 450 views
  • 0 likes
  • 2 in conversation