BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Toni2
Lapis Lazuli | Level 10

hi, i have the below dates in months. i want to insert some more dates after the last date (30/04/2021). I mean i want to add dates till 31/12/2026 but not sure how i can do it. Please note that i want the last day of each month. for example, 30/05/2021, 31/06/2021 etc.

 

Any idea it would be appreciated ? 

 

31/07/2020
31/08/2020
30/09/2020
31/10/2020
30/11/2020
31/12/2020
31/01/2021
28/02/2021
31/03/2021
30/04/2021
1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

Do you have strings looking like dates, or sas dates?

Maybe something like (code is untested):

data want;
  set have end=startLoop;
  output;
  if startLoop then do;
   do until (date = '31Dec2026'd);
     date = intnx('month', date, 1, 'end');
    output;
  end;
run;

View solution in original post

1 REPLY 1
andreas_lds
Jade | Level 19

Do you have strings looking like dates, or sas dates?

Maybe something like (code is untested):

data want;
  set have end=startLoop;
  output;
  if startLoop then do;
   do until (date = '31Dec2026'd);
     date = intnx('month', date, 1, 'end');
    output;
  end;
run;

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!

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
  • 1 reply
  • 597 views
  • 1 like
  • 2 in conversation