Hi there. My goal = write code so that, if a urinary lab test (the albumin/creatinine ratio) is coded as positive two or more times within a 6 month period, then this observation and its corresponding date needs to red-flagged as positive for a suspected diagnosis of diabetic nephropathy in children and adolescents with type 1 diabetes. The main variables for this set of code are "ID_nr" (numeric format, 12 numbers), alb_creat_ratio, and test_date. Based on a set rules I have already written, alb_creat_ratio = 0 means it is a negative screening test and alb_creat_ratio = 1 means it is a positive screening test. What code should I write so that, if there are two or more positive tests over a 6-month period, then that condition -- identified by generating a new variable called nephropathy_status -- where 0 = none and 1= positive for diabetic nephropathy . My apologies for asking such a "oh, he's obviously a beginner" type of Stata question.
Example generated by -dataex-
clear
input double(ID_nr raw_data_alb_creat_ratio) long test_date float(alb_creat_ratio albu_creat_screen_date )
121212121212 .3 18245 0 18245
131313131313 7 18245 1 18245
141414141414 2 18249 0 18249
151515151515 6 18273 1 18273
161616161616 46.2 18288 1 18288
171717171717 1.3 18338 0 18338
Example generated by -dataex-
clear
input double(ID_nr raw_data_alb_creat_ratio) long test_date float(alb_creat_ratio albu_creat_screen_date )
121212121212 .3 18245 0 18245
131313131313 7 18245 1 18245
141414141414 2 18249 0 18249
151515151515 6 18273 1 18273
161616161616 46.2 18288 1 18288
171717171717 1.3 18338 0 18338
Comment