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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 250 views
  • 0 likes
  • 3 in conversation