random - sas,how to randomly assign a patient to a clinic if he/she goes to multiple clinics -
I would like to analyze the compliance rate at the clinic level, but I have a lot of patients who are related to many clinics. I want to give a random clinic to each such patient. How does anyone know how to do this? I read proc surveys, proc plans, but not to make sure how to do it.
Thanks a long time ago!
If you are just looking for a clinic at random, then If the patient happens multiple times in the same clinic, then that clinic will be more likely to be selected; If you do not want that, the first / dipped by the patient / clinic proc of survey Select is
in the data at the time of making the works fine, see the code below.
n = 1 says that choose a record at each level.
is the data; Do the patient = 1 to 20; Clinic = 1 to ceiling (3 * rand ('uniform')); Output; End; End; Run; Proc SurveyElected Data = Outside = wantn = 1 seed = 12345; Class patient; Run;
Comments
Post a Comment