BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DanD999
Quartz | Level 8

Is there something to get the date range from the beginning of the year to the end of the most recently week like there is for a year-to-date monthly or quarterly date range?

 

options sysparm ="parmmaker=20000101~ytd_qtr~1~1,file_sfx=_test,run_as_test=Y";

or

options sysparm='parmmaker=20000101~ytd_mon~0~0,file_sfx=test,client=SHELLOIL';

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
DanD999
Quartz | Level 8

@PeterClemmensen wrote:

You can obtain the two date value like this. Not sure how this relates to you options sysparm statements though 🙂

 

data _null_;
    YearStart=intnx('year', today(), 0, 'b');
    RecentWeekEnd=intnx('week.2', today(), 0, 'b')-1;
    put YearStart date9. // RecentWeekEnd date9.;
run;

Thanks. I know how to do it that way. I think it must be a function that is internal to our company that someone wrote. We have a macro that generates a variety of dates and date formats based on the sysparm. I think there is something that is internal to that function that generates the date range that I want when it sees "ytd_mon" or "ytd_qtr". I look in there to see if there is one for weekly too.

 

Thanks again.

View solution in original post

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

Do you want all these dates in a data set or simply the two dates?

DanD999
Quartz | Level 8

@PeterClemmensen wrote:

Do you want all these dates in a data set or simply the two dates?


Just the begin and end dates. I'm wondering if this is something that was done internally and is not a SAS function. Thanks for the quick reply.

PeterClemmensen
Tourmaline | Level 20

You can obtain the two date value like this. Not sure how this relates to you options sysparm statements though 🙂

 

data _null_;
    YearStart=intnx('year', today(), 0, 'b');
    RecentWeekEnd=intnx('week.2', today(), 0, 'b')-1;
    put YearStart date9. // RecentWeekEnd date9.;
run;
DanD999
Quartz | Level 8

@PeterClemmensen wrote:

You can obtain the two date value like this. Not sure how this relates to you options sysparm statements though 🙂

 

data _null_;
    YearStart=intnx('year', today(), 0, 'b');
    RecentWeekEnd=intnx('week.2', today(), 0, 'b')-1;
    put YearStart date9. // RecentWeekEnd date9.;
run;

Thanks. I know how to do it that way. I think it must be a function that is internal to our company that someone wrote. We have a macro that generates a variety of dates and date formats based on the sysparm. I think there is something that is internal to that function that generates the date range that I want when it sees "ytd_mon" or "ytd_qtr". I look in there to see if there is one for weekly too.

 

Thanks again.

Tom
Super User Tom
Super User

What is your actual question?

SYSPARM is a generic option to the user pass in text on the command line when stating SAS.

How the program that you wrote is using that string you will need to tell us.

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!

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