Hello everyone,
I am working on a cohort study at the moment using a dataset very similar to the example posted below.
I have defined the exposed cohort and I would appreciate your advice regarding matching to unexposed controls.
The index date is the date that exposed participants enter the cohort study (the latest of their start of follow-up or date they become exposed).
The idea is to match 1:3 the exposed participants to eligible controls, on exact sex, area and +/-3 on year of birth.
I have previously used the rangejoin command to achieve the above but I have not found a way to account for the following:
I am using Stata/IC 16.1 for Windows.
Variables:
case=1 represents the exposed cohort (n=104,774)
case=0 are the potential controls
indexdate: Date that exposed participants enter the study
exposed: 1= an eligible control later becomes exposed
expdate: Exposed date - date at which the control becomes exposed
area,sex,yearb: Matching variables
start, stop : Date variables indicating the availability of follow-up
Using the same control more than once is acceptable.
Thank you,
Louisa
I am working on a cohort study at the moment using a dataset very similar to the example posted below.
I have defined the exposed cohort and I would appreciate your advice regarding matching to unexposed controls.
The index date is the date that exposed participants enter the cohort study (the latest of their start of follow-up or date they become exposed).
The idea is to match 1:3 the exposed participants to eligible controls, on exact sex, area and +/-3 on year of birth.
I have previously used the rangejoin command to achieve the above but I have not found a way to account for the following:
- Controls need to be unexposed at the index date of their match and have one year of available follow-up prior to and following the index date
- Controls might become exposed during follow-up, in which case I would like them to no longer be available as controls and start contributing to the exposed cohort with their own set of matched controls.
I am using Stata/IC 16.1 for Windows.
Variables:
case=1 represents the exposed cohort (n=104,774)
case=0 are the potential controls
indexdate: Date that exposed participants enter the study
exposed: 1= an eligible control later becomes exposed
expdate: Exposed date - date at which the control becomes exposed
area,sex,yearb: Matching variables
start, stop : Date variables indicating the availability of follow-up
Using the same control more than once is acceptable.
Thank you,
Louisa
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(id case indexdate exposed expdate) int area byte sex int yearb float(start stop) 1 0 . 1 15652 3 1 1934 15418 16753 2 1 17696 . . 9 2 1944 11855 20457 3 0 . 1 19159 4 2 1921 17471 19167 4 0 . 0 . 85 1 1926 15353 19551 5 1 20200 . . 37 2 1948 14948 20618 6 0 . 0 . 79 1 1911 10721 14457 7 0 . 0 . 1 2 1925 10848 18933 8 0 . 0 . 24 2 1946 11941 18652 9 0 . 0 . 2 1 1944 18130 19564 10 1 18127 . . 1 1 1937 10848 18933 11 0 . 0 . 2 2 1939 16400 19414 12 0 . 0 . 97 2 1943 16266 17792 13 1 15327 . . 5 2 1929 13744 16400 14 0 . 1 16751 5 1 1927 13744 16822 15 1 20240 . . 5 1 1927 13744 21339 16 0 . 0 . 92 1 1939 13329 19433 17 0 . 1 14626 25 2 1927 14552 15103 18 0 . 0 . 6 2 1930 12023 15943 19 0 . 0 . 88 2 1929 19402 21238 20 0 . 0 . 79 2 1947 10721 20318 21 0 . 0 . 10 2 1926 15510 16672 22 1 15298 . . 132 1 1918 13003 16537 23 0 . 0 . 77 1 1943 15851 19932 24 0 . 0 . 2 2 1939 16400 19564 25 0 . 0 . 21 2 1924 16512 18842 26 1 17604 . . 152 1 1925 13038 19828 27 0 . 0 . 42 2 1931 14744 17854 28 0 . 0 . 8 1 1949 18829 20247 29 0 . 0 . 48 2 1954 15547 21826 30 0 . 0 . 4 1 1931 14126 19348 31 0 . 0 . 6 2 1925 11996 18000 32 0 . 0 . 237 2 1933 16925 17903 33 0 . 0 . 65 2 1932 15142 20644 34 0 . 1 17588 63 2 1934 11570 17672 35 0 . 1 19360 8 1 1935 18408 19407 36 0 . 0 . 92 1 1943 17360 19433 37 0 . 0 . 49 1 1952 14362 21356 38 0 . 0 . 6 2 1943 11996 17776 39 1 15049 . . 54 1 1936 14621 16855 40 0 . 0 . 54 1 1945 14621 21838 41 1 15545 . . 63 1 1938 15001 17627 42 0 . 0 . 5 1 1938 13744 16663 43 0 . 0 . 6 1 1940 11996 19514 44 0 . 0 . 9 2 1948 15215 20457 45 0 . 1 19221 9 2 1940 11610 19228 46 0 . 1 20865 91 2 1951 14805 21838 47 0 . 0 . 2 1 1930 16400 19564 48 0 . 0 . 68 2 1928 15348 19093 49 0 . 0 . 70 2 1944 15623 18273 50 0 . 0 . 20 1 1944 18666 19897 51 0 . 0 . 99 1 1946 11096 20042 52 0 . 0 . 49 2 1930 14362 21032 53 1 17027 . . 25 2 1920 14738 17413 54 0 . 1 18561 117 2 1941 18395 19777 55 0 . 0 . 70 2 1920 15623 17078 56 0 . 1 17448 2 2 1909 17351 17938 57 0 . 0 . 85 2 1941 15353 21828 58 0 . 0 . 77 2 1938 15851 19932 59 0 . 0 . 35 1 1941 15275 20112 60 0 . 0 . 5 2 1948 13744 21339 61 0 . 0 . 5 2 1902 13744 16410 62 0 . 0 . 1 2 1920 12514 18933 63 0 . 1 13920 13 2 1909 11223 13959 64 0 . 0 . 26 2 1912 13216 15062 65 0 . 0 . 9 1 1940 11308 18117 66 0 . 0 . 87 2 1931 12223 16210 67 0 . 0 . 1 2 1946 10848 18933 68 0 . 0 . 2 1 1942 16400 19564 69 0 . 0 . 5 2 1932 13744 15944 70 0 . 0 . 148 1 1927 11944 19216 71 0 . 0 . 69 2 1908 13706 14646 72 1 13160 . . 38 2 1920 10778 16087 73 0 . 0 . 80 2 1906 13668 15887 74 0 . 0 . 6 2 1933 12115 19514 75 0 . 0 . 2 2 1929 16400 19564 76 0 . 0 . 4 2 1928 14126 19348 77 1 17338 . . 1 1 1931 10848 17825 78 0 . 0 . 6 1 1945 11996 19514 79 0 . 0 . 6 2 1944 18463 19514 80 0 . 0 . 36 1 1920 15225 16082 81 0 . 0 . 6 1 1924 11996 18469 82 0 . 0 . 60 1 1936 11972 21748 83 0 . 0 . 63 2 1943 11570 20607 84 1 20100 . . 43 2 1951 13970 21828 85 0 . 0 . 26 1 1939 18333 19264 86 0 . 0 . 1 1 1925 10848 18360 87 0 . 0 . 54 2 1948 19158 20177 88 0 . 0 . 141 2 1923 13015 19040 89 0 . 0 . 60 1 1941 11920 17369 90 0 . 0 . 54 1 1928 14621 18703 91 0 . 1 15064 6 1 1926 11996 15195 92 0 . 0 . 64 2 1941 13220 19383 93 0 . 0 . 71 2 1944 15980 21828 94 0 . 0 . 68 2 1936 15348 18954 95 1 13048 . . 1 2 1913 10848 15793 96 0 . 0 . 8 2 1949 18408 20247 97 1 18961 . . 195 1 1947 10960 19976 98 0 . 1 16498 2 2 1922 16400 17119 99 0 . 0 . 5 1 1946 13744 21339 100 0 . 0 . 5 2 1921 13744 16537 end format %td indexdate format %td expdate format %td start format %td stop
Comment