Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: generating matched set ID's after PSMATCH2


From   "Ariel Linden, DrPH" <ariel.linden@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: generating matched set ID's after PSMATCH2
Date   Sun, 19 Sep 2010 13:18:43 -0400

Hi All,

Perhaps someone has some code to generate IDs of matched sets after running
the user written program PSMATCH2?

More specifically, I'd like to generate grouped matches with an ID for all
matches within that set. So if there were 4 controls matched to 1 case, that
particular group should have a count of 5, and the same group ID should show
up 5 times. If 1 control was matched to 1 case, there should be two
individuals with the same group ID.

Thus, the final outcome would be to have a variable (called groupID)with a
sequential list of IDs (Starting at 1)representing all those cases and
controls within that matched set. In the example below (assuming 1 to 1
matching), tx = treatment, _id = the subject ID, _n1 = matched control ID,
and groupID is the id of both matched case and control. As you can see,
there are two of each groupID. 

Tx	_id 	_n1	groupID
1	1	6	1
1	2	7	2
1	3	8	3
1	4	9	4
1	5	10	5
0	6	.	1
0	7	.	2		
0	8	.	3
0	9	.	4
0	10	.	5

Thanks in advance!

Ariel

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index