BookmarkSubscribeRSS Feed
Kimberly09
Fluorite | Level 6

Hi  - 

I would like to obtain a count of  ED visits and hospital admissions that occurred within 90 days by type and location (inside facility vs all other outside facilities/hospitals). I've spent the entire morning and most of the afternoon trying to figure this out to no avail. Your help is greatly appreciated! 

Actual sample size = 1290 

I want to count the number of visits with respective to visit type and visit facility. 

Variables of interest:  

NC1 - NC6: 1 = ED visit, 2 = Hospital admission 

 

NC1LOC - NC6LOC: 20 = Inside facility, 21 - 49 = All other outside facilities

 

I've manually counted the number of visits by each type and facility for the first observation to give you an idea of what I need help with (please see last 4 columns in the table).

 

Also, I wonder if there's another way (besides proc sort) to organize the visit dates for each row (observation) so that they are in ascending order. This isn't a pressing need at the moment but would be helpful for future reference. Thank you so much! 

 

Sample data set 

INQFROMINQTONC1NC1LOCNC1ADMITNC1DISCHARGENC2NC2LOCNC2ADMITNC2DISCHARGENC3NC3LOCNC3ADMITNC3DISCHARGENC4NC4LOCNC4ADMITNC4DISCHARGENC5NC5LOCNC5ADMITNC5DISCHARGENC6NC6LOCNC6ADMITNC6DISCHARGEIN_EDIN_HOSPITALOUT_EDOUT_HOSPITAL
12/23/20173/23/20181202/9/20182/9/20181202/19/20182/19/20181202/25/20182/25/20181203/5/20183/5/20181203/18/20183/18/20181273/22/20183/22/20185010
12/14/20173/14/201812012/20/201712/20/201722012/20/201712/22/20171201/10/20181/10/20182201/10/20181/12/20182261/15/20181/16/20182201/26/20181/27/2018????
10/28/20171/26/201812311/2/201711/2/201722311/2/201711/8/201722011/8/201711/16/201712012/11/201712/11/201722012/11/201712/17/2017    ????
6/29/20189/27/20181207/20/20187/20/20182277/26/2018 1277/19/20187/19/20181277/5/20187/5/20182277/26/20187/30/2018    ????
9/5/201712/4/20171279/23/20179/23/20171279/23/20179/24/20172279/29/201710/9/201712710/17/201710/17/201712310/18/201710/18/2017    ????
5/6/20188/4/20182445/9/20185/11/20182445/24/20185/24/20182205/7/20185/9/2018    2206/17/20186/19/2018    ????
6/5/20199/3/20191287/13/20197/13/20192287/15/20197/17/20192447/17/20197/22/2019            ????
4/11/20197/10/20191314/20/20194/20/20191206/12/20196/12/20191316/16/20196/16/2019            ????
11/10/20162/8/201712011/10/201611/10/201622011/22/201611/28/2016    22012/7/201612/9/2016        ????
6/6/20199/4/20192237/9/2019 2237/31/20198/2/20192238/29/20199/4/2019    2238/29/20199/4/2019    ????

 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

@Kimberly09 wrote:

 

 

Also, I wonder if there's another way (besides proc sort) to organize the visit dates for each row (observation) so that they are in ascending order. This isn't a pressing need at the moment but would be helpful for future reference. Thank you so much! 

In a SAS data step, the CALL SORTN function will organize the visit dates for each row in ascending order. Example: https://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=p0exzteatvicqkn1bzyzs0qaecy1.htm...

 

You might want to consider renaming the variables such that the number is at the end, this will enable you to refer to your variables as nc_admit1-nc_admit12, which is much easier than typing all of them out.

--
Paige Miller
Kimberly09
Fluorite | Level 6
Thanks for providing this resource!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 450 views
  • 0 likes
  • 2 in conversation