BookmarkSubscribeRSS Feed
rahulpatil6886
Calcite | Level 5

Generate a report for a 15-day period starting exactly 1,000 days before today. The report title should include the start date (Day 1) and end date (Day 15) of this period.

Expected output: 
rahulpatil6886_0-1769737014634.png

 

4 REPLIES 4
Kurt_Bremser
Super User

Show what you have already tried and where your problems are. Note: SAS date values are counts of days, so the 1000-day and 15-day intervals are simple to build.

Ksharp
Super User

Once you get these start and end date like the following, that would be very easy thing.

 

data start_end;
do start=date()-1000 to date() by 15;
 end=start+14;
 output;
end;
format start end date9.;
run;
PaigeMiller
Diamond | Level 26

@rahulpatil6886 Please go back to your original post and modify the subject line to briefly describe the problem. When you use a subject line like "Problem 1", no one knows if this is a problem they will be interested in or not.

--
Paige Miller
Quentin
Super User

Not sure if you're asking about how to generate the title, or the WHERE statement for filtering your data.  Can you show an example of the code you have tried?

 

I would likely use the macro variables to store the start and end of the interval.  You could calculate those like:

%let start= %sysfunc(intnx(day,%sysfunc(today()),-1000),date9) ;
%let end=   %sysfunc(intnx(day,%sysfunc(today()),-1000+15),date9) ;
%put &=start &=end ;

 

The Boston Area SAS Users Group is hosting free webinars!

Register now at https://www.basug.org/events.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
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
  • 4 replies
  • 911 views
  • 0 likes
  • 5 in conversation