BookmarkSubscribeRSS Feed
uabcms
Calcite | Level 5

I have a group of patient records for whom I want to look 6 months pre and post their hospitalization for various types of activity (clinic visits, imaging, etc.).   The files I will use to get these activities have a ID field and a date field. 

  Here are a few caveats to setting up my patient records to search for the pre-post activity:

    1) There will be patients with more than one admit.

    2)  We don't want to duplicate count any of the pre-post activity so,

           a.   If a patient has a 2nd admit within 6 months of the first admit his/her 'Post' activity should only include data NOT included

                    as part of the previous admit.   Ex) patient with an admit on Jan 1 will have 'Post' activity from Jan - June.     If that same                         patient was admitted again on Feb 1, his 'Post' activity will only include data from July.      If that patient has a third                                admit on May 1 his 'Post' activity will only include data from Aug-Oct.

 

           b. Regarding the 'Pre' activity,  If a patient has an initial visit on Jan 1, he will have 'Pre' activity from Aug-Dec of the previous                      year and 'Post' activity from Jan-June.   If that same patient has an admit again on Feb 1 then he would have no 'Pre'                            activity because if would have been captured in the previous admit's pre/post activity.  So,  unless there is at least 6 months                  between a single patient's admits, he will have no 'Pre' activity.

 

 Like I said, once I determine the time frame of activity needed for each record, I will then merge with the 'Activity' datasets.  By patient ID.

 

Any insight would be appreciated.

 

 

5 REPLIES 5
Amir
PROC Star

Please edit your question to provide some data in the form of a data step using datalines, so that others can work with a representative example of what you have.

 

Also please try editing your original question to reformat it so that it is easier to read.

 

 

Thanks,

Amir.

Reeza
Super User
What type of insights are you looking for here? If you need help with code you'll need to provide sample data. Please include at least one of each case above and one that doesn't meet your conditions.

If you just need general guidance, are you comfortable with SQL?
uabcms
Calcite | Level 5

Attached a file containing a list of hospital admissions.  It is 'Testlist'.

 

Also attached a file of locations the patients have been seen in.  This is the Pre/Post activity.   ('Activity')

 

Regarding the disjointed layout of my initial request,  it didn't look like that as I was typing it. When I posted it got messy.

ScottBass
Rhodochrosite | Level 12

From @Amir :

Please edit your question to provide some data in the form of a data step using datalines, so that others can work with a representative example of what you have.

 

Also please try editing your original question to reformat it so that it is easier to read.

 

What part of that didn't you understand?  Why do you think posting some Excel files helps us help you?  Do you expect us to write the code to import your Excel data, just so we can then address your question?

 

How about you exert a little effort in asking your question?


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
uabcms
Calcite | Level 5

Apologies for the sloppy start.   Was try to get something uploaded before leaving in a hurry for the long weekend. 

Probably should have waited until today.   Appreciate the 'correction'.

Below is the request as best as I can describe it.  I've attached SAS code that creates  2 datasets.  One is the

'master' patient  file (Patients) and one is the file I will use to look for Pre and Post activity.   

I'm not sure how to proceed after that.  Thus no further code.

 

I have a group of patient records for whom I want to look 6 months pre and post their hospitalization for various types of activity (clinic visits, imaging, etc.).   

  Here are a few caveats for counting the pre-post activity visits:

    1) There will be patients with more than one admit.

    2)  We don't want to duplicate count any of the pre-post activity so,

           a.   If a patient has a 2nd admit within 6 months of the first admit his/her 'Post' activity should only include data

                  NOT included  as part of the previous admit.   Ex) patient with an admit on Jan 1 will have 'Post' activity

                  from Jan - June.     If that same patient was admitted again on Feb 1, his 'Post' activity will only include data

                  from July.      If that patient has a third admit on May 1 his 'Post' activity will only include data from Aug-Oct.

 

           b. Regarding the 'Pre' activity,  If a patient has an initial visit on Jan 1, he will have 'Pre' activity from Aug-Dec

               of the previous year and 'Post' activity from Jan-June.   If that same patient has an admit again on Feb 1

               then he would have no 'Pre'  activity because if would have been captured in the previous admit's pre/post

               activity.  So, unless there is at least 6 months between a single patient's admits, he will have no 'Pre'

                activity -other than that from the initial admit.

 

 

The output I need is the total number of Pre and Post visits - by clinic location.  So,

 

Location   # Pre visit # Post visits
EF OP    
HK BUILDING    
PLASTIC SURGERY AND LASER CLINIC    
KC CARDIOLOGY PROCEDURES    
KC HEM ONC    
KC MAMMOGRAM    
Etc.    

     

 

Hopefully, this is more helpful.  Thanks.

 

BTW, when I check the 'Preview' panel the layout of my text looks fine.   It changes when it's posted.  Any insight on

that would be appreciated also.

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1209 views
  • 1 like
  • 4 in conversation