BookmarkSubscribeRSS Feed
niki0209
Obsidian | Level 7

Hi

I have a data set with 134 people in the treatment group and 17.000 people in the potential statistical control group.

I want to do exact matching, where each person in the treatment group gets 5 exact matches from the control group.

My problem is that I want to include the persons status in the month they began treatment in the matching, but the control group doesn't have a start month, because they didn't receive treatment. So I want each treated persons 5 matches to be assigned the same "start month", so I compare their statuses at the same time.

 

The problem is that I only learn the control groups start month after they have been matches to a specific treated person. But I can't do the matching, unless I know at what month to look at the control group's status. So it's a bit of a conundrum.

I'm thinking it must be some kind of macro where I look at each person in the treatment group one at a time, find all their matches (without the status), look at their status on the treated person's start month, and assign 5 matches who have the same status at the same time. And then do the same for de other 133 people, one at a time.

 

Does anyone have experience with this and is able to help me?

 

Thanks a lot! 🙂

6 REPLIES 6
Kurt_Bremser
Super User

Please supply usable example data (in a DATA step with DATALINES/CARDS, as shown here) so we get an idea about your data structure and have something to test code against.

Please include the expected result of the transformation.

adam633_SAS
Calcite | Level 5

Would you consider to use the propensity score matching?

According to your statement, I think that using proc psmatch might be helpful.

For example: 

proc psmatch data=drugs region=cs;
   class Drug Gender;
   psmodel Drug(Treated='Drug_X')= Gender Age Bmi;
   match method=exact(k=5) exact=Gender stat=lps caliper=0.25;
   assess lps var=(Gender Age Bmi) / weight=none plots=(boxplot barchart);
   output out(obs=match)=Outgs lps=_Lps matchid=_MatchID;

In the match statement, you can assign method=exact, k=5 for your situation.

Astounding
PROC Star

The one time I had to do something like this, I started with the distribution of start month from the treatment group.  I used that distribution to randomly assign a start month to the control population.  Then I used the complete set of characteristics to find matches.

mkeintz
PROC Star

@Astounding wrote:

The one time I had to do something like this, I started with the distribution of start month from the treatment group.  I used that distribution to randomly assign a start month to the control population.  Then I used the complete set of characteristics to find matches.


Depending on how persnickety your reviewer is likely to be, you may want to determine whether start month is at all correlated with other attributes of interest within the treatment group.  If so, then the random assignment of start month for control cases might need to take those attributes into account.  

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Astounding
PROC Star

For me, handling correlated independents was part of a class that overwhelmed me and put me to sleep 50 years ago.  I leave it to the heavy-duty stats people to sort this one out .

Reeza
Super User
Since you're creating the control groups start month, if you use a greedy algorithm, where once a control is matched it isn't used again, then maybe there is no issue.

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
  • 6 replies
  • 538 views
  • 2 likes
  • 6 in conversation