BookmarkSubscribeRSS Feed
dwhitney
Calcite | Level 5

I am using administrative claims data. I am interested in identifying "fragility fracture" based on claims. I have created a variable for any fracture and a variable for trauma codes. To get fragility fracture, the date of the claim for fracture cannot be the same date for the claim for a trauma code. I have the data in the long format. I have grouped the data by patid (patient ID), fst_dt (date of claim), Fx_claim (fracture, yes/no), Trauma_claim (relevant trauma codes, yes/no). In the long format, how would I go about coding to capture fractures that do not have a trauma code on the same day?

 

Thank you! 

3 REPLIES 3
ballardw
Super User

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 {i} icon or attached as text to show exactly what you have and that we can test code against.

 

Manually create an example of the desired output as well for the example input.

 

 

Since Yes/No can be coded so many different ways we really need some example data to provide a good solution as a comparison written for one assumed coding standard is very likely not to actually work for a different one.

dwhitney
Calcite | Level 5

I'm sorry! I meant to attach some example code. Thank you for sharing that link. That is really helpful.

 

Here is some example code. For Fx_claim and Trauma_claim, 0=no claim and 1=1 claim. 

Patient 1 has 2 fragility fractures (Fx_claim=1 and Trauma_claim=0 for the same day) and 1 non-fragility fracture (Fx_claim=1 and Trauma_claim=1 for same day);

Patient 2 has a non-fragility fracture (Fx_claim=1 and Trauma_claim=1 for the same day);

Patient 3 has no fracture or trauma code (both=0).

 

patid    fst_dt                Fx_claim   Trauma_claim

1          2016-01-01        0                    0

1          2016-02-03        1                    0

1          2016-02-05        0                    0

1          2016-12-01        0                    0

1          2016-07-05        1                    0

1          2016-07-17        1                    1

1          2016-09-02        0                    0

2          2016-02-04        0                    0

2          2016-05-21        1                    1

2          2016-10-25        0                    0

2          2016-11-11        0                     0

3          2016-02-19        0                    0   

3          2016-04-26        0                    0

3          2016-04-28        0                    0

3          2016-06-12        0                    0

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 669 views
  • 0 likes
  • 3 in conversation