BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
chancc
Calcite | Level 5

Hi,

I am trying to analyze data involving if there was a hospitalization (Y/N) in the first 6 months from a transplant date.  TRR transplant date is the date of transplant, SAS180 is 180 days after date of transplant, and then TRF status date is the date of follow up.

 

I want to tell SAS to look at Y/N for hospitalization if the TRF status date is between the time interval "date of transplant" and "SAS180". And remove any record if TRF status date is beyond the SAS180 date.  Does anyone know what I can do to achieve this? 

 


Thanks!

 

 


Screen Shot 2016-11-15 at 12.01.32 AM.png
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Use INTNX to set the date to the end of the month. You can do this within your comparison rather than create a new variable. 

View solution in original post

5 REPLIES 5
Reeza
Super User

Can you assume you'll always have dates or do you need to account for missing data? 

 

Anyways, you can compound your conditions using an AND

 

Length check $3.;

if status>=transplant AND STATUS<=sas180 then check='ok';

else check='bad';

 

Then you can filter on your check variable. I create this variable so I can confirm my code before removing records - makes it easier to debug. 

chancc
Calcite | Level 5

Thanks I will give this a try!

 

Ideally, I would want to capture if TRR Status Date was even within the same month and year of SAS 180 (if exceeds the interval by a few days, no big deal). But I feel that is too complicated in SAS? I was going to manually read it over.

chancc
Calcite | Level 5

What you suggested worked! 

 

Do you know if there is a way I can expand this a bit more so it is not just the 6 month SAS 180 exact date but includes the entire month of SAS180 date? 

 

So if the follow up date was 5/10/16  and the SAS 180 date was 5/05/16, I still want that to be included...

Reeza
Super User

Use INTNX to set the date to the end of the month. You can do this within your comparison rather than create a new variable. 

Reeza
Super User

Set it to the end of the month instead of beginning

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2826 views
  • 0 likes
  • 2 in conversation