Hi i need to run the job on first of every month.so iam using below condition.but how can i test the below one it is working as expected please
%sysfunc(day(%sysfunc(today())))=1
iam running above cmd in SAS EG.nothing is coming in output.please help.
You can test it like this
%let day= %sysfunc(day(%sysfunc(today())));
%put The value is &day.;
You can test it like this
%let day= %sysfunc(day(%sysfunc(today())));
%put The value is &day.;
Thanks @PeterClemmensen .
please suggest how can i get day=01,i ran this code i got day=21.
but i need day=01.please help
I don't understand this. You want to run some code conditional on the fact that it is the first day of the month, correct?
If you simply want to test the code you really want to run on the first, simply make your code conditional on the 21'th day. Then test. Then change it back again.
Hello,
I was wondering why you have to do something in the code to check for 1st day of month. Can't you just schedule the job to run 1st of every month. What environment do you have? Linux/unix you have Crontab and on Windows you have the SAS EG schedule (File > Schedule and setup the triggers). We might want more information on what your trying to achieve.
HI @JJP1
The following code retrieve the first day of the month in the macro variable job_time.
E.g. today is November 21st 2019 -> the macro variable will be equal to November 1st 2019
I am not sure if this is what you want?
%let job_time= %sysfunc(intnx(month,%sysfunc(today()),0,b));
%put &job_time;
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!
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.