BookmarkSubscribeRSS Feed
grhyne
Calcite | Level 5

Hi, thanks for reading.

 

 I am trying to predict upcoming time periods based off enrollment dates. The electronic data capture system I use only gives me a list up to "Due in 90 days" but I want to make it easier and get upcoming time periods until the end of 2023. This would be for multiple subjects throughout the year. I already have a code to match the subject ID and MRN and want to expand it to predict upcoming visit windows and due dates.

 

I am thinking of using the Visit Window Date Calculations but want to automate it with SAS, calculation is in the file below. 

 

I know there are a couple ways to do this, like INTNX function, but am not sure how to translate it here. Is there a better way?

 

Thanks,

 Gloria

 

3 REPLIES 3
ballardw
Super User

Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.

 

 

Data  are ideally in the form of a data step but clearly described simple text posted into a text box opened with the </> icon above the message window may work. A worked example is helpful as well.

 

Text or a link to a description of the calculation are helpful.

 

Note: processes described in spreadsheets are generally not  implemented the same way in SAS.

grhyne
Calcite | Level 5

Sorry! Didn't know that about excel files, here is an example of the date calculations:

 

Consent date: 3/21/18

Visit 2: Year 1 Follow up

Visit Open Date Calculation: 180 after consent date or 9/17/2018

Visit Window Close Date Calculation: 365 Days (1 Yr) + 180 Days = 545 Days after Consent Date of 9/17/2019

Form Due Date: 12/16/2019

 

 

Tom
Super User Tom
Super User

So if you have this dataset:

data have;
  consent_date='21MAR2018'd;
  format consert_date date9.;
  do year=1 to 5;
     output;
  end;
run;

You can create a new dataset with your two new variables like this:

data want;
  set have;
  open_date = intnx('year',consent_date,year-1,'same')+180;
  close_date = intnx('year',consent_date,year,'same')+180;
  format open_date close_date date9.;
run;

Result

 

Tom_0-1681327121517.png

 

 

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 657 views
  • 0 likes
  • 3 in conversation