BookmarkSubscribeRSS Feed
Geoghegan
Obsidian | Level 7

I have a dataset where I have information about hospital admissions for a year. In this dataset, I created a variable DIS where if DIS=1 they were diagnosed with a disease of interest during that specific admission. If DIS=0, they were not diagnosed with that disease during that specific admission. I made a separate dataset where I only included admissions where DIS=1 to look at just admissions where this diagnosis was present. I also used a unique identifier to see if and how many times individuals were readmitted with that same diagnosis (Readmitted=1 means this is a readmission with the diagnosis of interest).

 

I need to compare the index admission (the first time that year each person was admitted with that diagnosis) by sorting into two groups by whether or not the person was later readmitted. I do have a variable made called Index where if Index=1, it is their first admission that year with the diagnosis and if Index=0 it is a readmission.  One of the variables I want to compare is whether or not the person was later deceased. To compare demographics (such as age) during the index admission, I believe I need to create a variable for readmission and for mortality which sort of looks forward in time at their later admissions and adjusts the variable in the index admission observation.

 

For example, if I created a new variable called EverReadmitted where 1=they were readmitted later that year with the same diagnosis and 0=they were not readmitted that year with the same diagnosis, I would need that EverReadmitted value to take into account all their admissions that year and make the value the same for every admission. That way I could separate out just the index admissions and still have the information I need. I think I’d do things the same way approximately for a mortality variable (have it take into account all their admissions – if there were multiple – and make the variable the same value in all their admissions/observations so I could look at just the index admission and see if they were ever deceased during an admission).

 

I think this is about what I’d need to do, but to be honest I am not at all sure of how to go about it, so I apologize, I can’t give example code and only assume there is a way to do this, I just have never done anything like it before. I'm using SAS Studio, if that is relevant. Any direction would be greatly appreciated!! Thank you!

1 REPLY 1
ballardw
Super User

Small Data example, desired result as data step code for the example. Enough records to demonstrate the principal and any exceptions An actual data set saves thousands of words describing what is in the data and properties of the variables.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the <> icon or attached as text to show exactly what you have and that we can test code against.

Or look at a number of posts on the forum that provide data.

 

Only include variables relevant to the problem and replace sensitive values with various strings like XXX and YYY.

 

If I have to make data to demonstrate something it is very likely I make something quite different than what you have. Which makes it hard for you to translate to your problem.

 

A general comment: when practical a numeric coding of 1/0 for true/false is extremely powerful. So if your variables congratulations on a good start.

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
  • 1 reply
  • 201 views
  • 0 likes
  • 2 in conversation