BookmarkSubscribeRSS Feed
tomas-andriotti
Calcite | Level 5

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

5 REPLIES 5
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
tomas-andriotti
Calcite | Level 5

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

Reeza
Super User
Please provide sample data to work with. Fake data is fine as long as it's the same structure as your data. IF you cannot, I suggest searching for 30 day readmission problem, which is a common metric reported and frequently asked. You can modify those to use your 365 day rule instead.
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
tomas-andriotti
Calcite | Level 5

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 637 views
  • 2 likes
  • 3 in conversation