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.)
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.