Hello!
Still new to SAS world and certainly very new to date conversion.
The query I'm trying to run, has dates, that has to be changed every day. the date plugged inside the query has to be in yymmddN8 format( eg: 20180827)
can you please let me know how do you convert tSAS today() date to the above said format.
Also I have a condition to verify , if the today is friday, get today date and sunday date also.
Please help!
@SaraDob wrote:
The query I'm trying to run, has dates, that has to be changed every day. the date plugged inside the query has to be in yymmddN8 format( eg: 20180827)
can you please let me know how do you convert tSAS today() date to the above said format.
Do you need that in a numeric or character variable?
@SaraDob wrote:
Also I have a condition to verify , if the today is friday, get today date and sunday date also.
Please help!
Look at INTNX for this one. WEEKDAY(TODAY()) returns the Weekday number, 1 being Sunday and 7 being Saturday.
Are you looking for the Sunday after or before the Friday? If before, use a negative interval, if after, use a positive interval.
What about holidays?
Is your value actually a numeric 20180827? Then it is not a date to SAS. Currently the largest valid number of days to treat as a date is around 6588970, about 14,000,000 less than your value.
If numeric then
input(put(today(),yymmddn8.),8.)
if character
put(today(),yymmddn8.)
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.