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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 1737 views
  • 0 likes
  • 2 in conversation