Hello I am trying to match cases to controls randomly in a ratio of 1:5 by sex and age. I have a data set (HAVE - created by PROC SQL step) containing the cases and potential controls, with the variables below; (rand_num - assigned random numbers) case_id, control_id, case_age, control_age, case_sex, control_sex, rand_num I initially used the code below to select 5 controls for each case. proc sort data=HAVE ; by case_id rand_num; run; data WANT not_enough; set HAVE; by case_id ; retain num; if first.case_id then num=1; if num le 5 then do; output WANT; num=num+1; end; if last.case_id then do; if num le 5 then output not_enough; end; run; How can I modify this in order to select 5 controls for each case without replacement (using controls only once)? Thanks
... View more