Hello ,
I am trying to create a 1:3 matching for a nested case control study (cases could serve as control until 0 for the same length of stay and admission year). What code can I use to match based on adm_year and LOS_cumulative_days without replacement. I tried previous codes using join by but doesnt seem to help. Thank you.
input float(Person_visit_ID adm_year LOS_cumulative_days case)
3 2019 2.5 0
3 2019 9.3 0
7 2021 27.2 0
7 2021 38.4 0
7 2021 .8 0
7 2021 31.9 0
8 2019 6.4 0
8 2019 3 0
10 2020 4.7 0
17 2020 10.9 0
17 2020 7 0
17 2020 7.1 0
21 2019 9.5 0
21 2019 32 0
24 2021 .4 0
24 2021 18.7 0
30 2019 13.2 0
30 2019 4.4 0
31 2019 4.3 0
44 2019 1.7 0
44 2019 .6 0
44 2019 4.8 0
57 2021 4.7 0
62 2019 55.3 0
62 2019 39.3 0
62 2019 56.6 0
62 2019 1.4 0
62 2019 36.5 0
62 2019 54 0
62 2019 15.5 0
62 2019 32.8 0
62 2019 30.6 0
64 2019 2.6 0
64 2019 6.5 0
65 2019 6.8 0
65 2019 3.7 0
65 2019 8.8 0
66 2019 2 0
66 2019 7.8 0
66 2019 12.9 0
66 2019 .2 0
66 2019 15.7 0
66 2019 3.7 0
67 2021 6.5 0
67 2021 1 0
68 2019 7.4 0
69 2019 6.6 0
69 2019 7 0
70 2021 .9 0
70 2021 3.9 0
70 2021 6.8 0
73 2019 17.2 0
73 2019 26.4 0
77 2019 5.3 0
77 2019 3.3 0
91 2019 6.1 0
91 2019 11.5 0
93 2019 2 0
93 2019 11.7 0
93 2019 12 0
93 2019 15.1 0
93 2019 9 0
94 2019 6.2 0
94 2019 12.4 0
94 2019 15.5 0
97 2019 4.6 0
97 2019 2.6 0
98 2021 1.2 0
98 2021 5.7 1
100 2019 1.6 0
100 2019 12.7 0
101 2019 4.1 0
103 2019 5.9 0
103 2019 1.8 0
112 2020 1.5 0
112 2020 2.3 0
112 2020 2.6 0
112 2020 4.2 0
113 2020 4 0
113 2020 1.3 0
114 2021 2.5 0
114 2021 5.5 0
115 2019 10.3 0
115 2019 3.5 0
116 2019 5 0
117 2019 18.8 0
117 2019 6.3 0
119 2019 11.1 0
120 2019 4.9 0
121 2019 8.2 0
122 2019 5.5 0
123 2020 7.8 0
128 2019 9.8 0
128 2019 9 0
128 2019 12.9 1
133 2019 4 0
144 2019 4.8 0
144 2019 3.6 1
145 2019 5.8 0
145 2019 2.8 0
end
[/CODE]
I am trying to create a 1:3 matching for a nested case control study (cases could serve as control until 0 for the same length of stay and admission year). What code can I use to match based on adm_year and LOS_cumulative_days without replacement. I tried previous codes using join by but doesnt seem to help. Thank you.
input float(Person_visit_ID adm_year LOS_cumulative_days case)
3 2019 2.5 0
3 2019 9.3 0
7 2021 27.2 0
7 2021 38.4 0
7 2021 .8 0
7 2021 31.9 0
8 2019 6.4 0
8 2019 3 0
10 2020 4.7 0
17 2020 10.9 0
17 2020 7 0
17 2020 7.1 0
21 2019 9.5 0
21 2019 32 0
24 2021 .4 0
24 2021 18.7 0
30 2019 13.2 0
30 2019 4.4 0
31 2019 4.3 0
44 2019 1.7 0
44 2019 .6 0
44 2019 4.8 0
57 2021 4.7 0
62 2019 55.3 0
62 2019 39.3 0
62 2019 56.6 0
62 2019 1.4 0
62 2019 36.5 0
62 2019 54 0
62 2019 15.5 0
62 2019 32.8 0
62 2019 30.6 0
64 2019 2.6 0
64 2019 6.5 0
65 2019 6.8 0
65 2019 3.7 0
65 2019 8.8 0
66 2019 2 0
66 2019 7.8 0
66 2019 12.9 0
66 2019 .2 0
66 2019 15.7 0
66 2019 3.7 0
67 2021 6.5 0
67 2021 1 0
68 2019 7.4 0
69 2019 6.6 0
69 2019 7 0
70 2021 .9 0
70 2021 3.9 0
70 2021 6.8 0
73 2019 17.2 0
73 2019 26.4 0
77 2019 5.3 0
77 2019 3.3 0
91 2019 6.1 0
91 2019 11.5 0
93 2019 2 0
93 2019 11.7 0
93 2019 12 0
93 2019 15.1 0
93 2019 9 0
94 2019 6.2 0
94 2019 12.4 0
94 2019 15.5 0
97 2019 4.6 0
97 2019 2.6 0
98 2021 1.2 0
98 2021 5.7 1
100 2019 1.6 0
100 2019 12.7 0
101 2019 4.1 0
103 2019 5.9 0
103 2019 1.8 0
112 2020 1.5 0
112 2020 2.3 0
112 2020 2.6 0
112 2020 4.2 0
113 2020 4 0
113 2020 1.3 0
114 2021 2.5 0
114 2021 5.5 0
115 2019 10.3 0
115 2019 3.5 0
116 2019 5 0
117 2019 18.8 0
117 2019 6.3 0
119 2019 11.1 0
120 2019 4.9 0
121 2019 8.2 0
122 2019 5.5 0
123 2020 7.8 0
128 2019 9.8 0
128 2019 9 0
128 2019 12.9 1
133 2019 4 0
144 2019 4.8 0
144 2019 3.6 1
145 2019 5.8 0
145 2019 2.8 0
end
[/CODE]
Comment