![]() ![]() You could well have 60 similarly named variable var1-var60 for instance though. Each value in a SAS dataset is a single variable. Your statement "I would like to obtain an array" may not be possible in the manner you are thinking as SAS arrays are temporary constructs for manipulating groups of variables and do not exist outside of data step code. Something that may affect your 60 day rules: Is it possible for any patient to have a second reference date? If so, could other reference dates be within 60 days of a previous? Since your example data has only single ATC types it is bit difficult to determine how you intend to apply the rule "for each different ATC value". Second, if you want a data set as output you will need to provide a better description of that output. Since you have a within 60 days requirement my first question: are the dates actual SAS date values or character variables? If the later likely the first thing will be to get actual date valued variables so time intervals can be determined. * try commenting out this last conditional if you have never used this before, it works together with the RETAIN statement above to reshape the table one row at a time ĭrop ATC reimb_date reimb_period reimb_datdif reimb_test success If ATC = 1 then ATC1_array = success Įlse if ATC = 2 then ATC2_array = success Įlse if ATC = 3 then ATC3_array = success Įlse if ATC = 4 then ATC4_array = success Įlse if ATC = 5 then ATC5_array = success * I assume three reimbursement periods, but changing the _3 to another number will add more ![]() If reimb_datdif le reimb_test then success = 1 Įlse if reimb_datdif gt reimb_test then success = 0 Reimb_datdif = datdif(ref_date,reimb_date,'ACT/ACT') * check if reimbursement occurred in 60 day periods Proc sort data = med1 by id ATC reimb_date run * sort the data to ensure reimbursements are tested correctly in next step Note I assumed three periods of 60 days, but you can add more where noted below. With more values of ATC it might become worth it to look into macros, but this should give you the table you are after. I used a brute force method so there is a little repetition. I'm a beginner in SAS and more used to R "way of thinking". I have difficulties to loop on my patients ids, my "dates" array, the different ATC etc. I'm trying to determine for each patient in my base, for periods of 60 days starting from their reference date, whether they did or did not receive a reimbursement of each "ATC" medication class in a given period of time.įor example for the patient with the id "1ABC" I would like to obtain an array ATC1 with the values "id" stands for the identifier of my patients, "refdate" is a reference date, "ATC" is a medication class, "reimb date" stands for reimbursement dates. I'm working on a database describing medication reimbursement. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |