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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

You can test it like this

 

%let day= %sysfunc(day(%sysfunc(today())));
%put The value is &day.;

View solution in original post

7 REPLIES 7
PeterClemmensen
Tourmaline | Level 20

You can test it like this

 

%let day= %sysfunc(day(%sysfunc(today())));
%put The value is &day.;
JJP1
Pyrite | Level 9

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

PeterClemmensen
Tourmaline | Level 20

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? 

JJP1
Pyrite | Level 9
Yes please
PeterClemmensen
Tourmaline | Level 20

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.

 

SuryaKiran
Meteorite | Level 14

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. 

Thanks,
Suryakiran
ed_sas_member
Meteorite | Level 14

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;

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 7 replies
  • 2170 views
  • 2 likes
  • 4 in conversation