Hi!
I am trying to recode a variable defined as freq_user in a long data set (longitudinal form). Frequent users (freq_users) were identified as those who went to the emergent department (ED) more often than 4 times a calendar year. However, I need to identify as freq_users those who went to the ED in 365 days in order that I can also capture, for example, those who went to the ED 2 times in one year and 2 times in the following but they still happened within 365 days.
- the name of the variables are :
Id: individuals
k: order of observations or visits
begdate : date of the observations - visit at the ED
y : calendar year
freq_user_y : 4 visits or more to the ED a year
Look forward to hearing from you.
Tomas
So, let's see if I understand what you want
Let's take July 1 as the start of the 365 day period, if a patient went to the emergency room 4 or more times between July 1 of one year and June 30 of the next year, that counts as a frequent user. But if the same patient went to the emergency room four times between July 2 of one year and July 1 of the next year, that patient is also a frequent user ... and so on for July 3, and July 4, and July 5 etc.
If that's right, you could certain use PROC EXPAND to compute the running sums, by patient, of emergency room visits over any 365 day period, and then find the patients with 4 or more in any 365 day period.
thank you for your answer.
yes, that is what I need to code now: frequent user at the ED who went 4 or more times within a year (365 days). For instance, if they went at the 7th time at the ED on July 4, 2015, and the 4ht visit had been on July 18, 2014, then they must be counted as a frequent user. However, if the period between 4 visits is greater than 365 days, then it should not be counted as such,
Let me know if you have more questions, please.
Tomas
So you need to create a data set where each patient has a record for each day, where the record takes on value 1 if the patient went to the emergency room that day, and a zero if the patient did not go to the emergency room that day. Then PROC EXPAND will compute the rolling sums to determine it the patient went 4 (or more) times in a 365 day time period.
yes, I am working with a dataset with one line per visit in which every patient has at least one visit.
the variables are;
1. id
2. begdate: date of visit
3. freq_user_y: frequent user a calendar year
4. year: calendar year
I wonder how I can code to get frequent user within 365 days rather than within a calendar year.
Thanks
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.