BookmarkSubscribeRSS Feed
yashpande
Obsidian | Level 7

Hi All,

 

I need an idea on how to proceed this.  I want to run a node (mostly it would be a user written node) till I get value updated from another table.

 

E.g. 

 

Code 1 /SQL Join transformation : 

Proc sql;

select user_name,user_id,email_address,lot_name,completed_flag,process_date from user_table where completed_flag=1 and process_date="&sysdate."d;

quit;

 

Code 2 : 

Send an email to user_name and email_address from Code1 ;

 

 

Now my requirement is to keep on checking for Code1 for entire day and the moment I get completed_flag's value as 1 , I need to send email to the  users.  In short, I need infinite while loop for Code1 till the day is completed. 

 

Any help/idea is appreciated

 

5 REPLIES 5
DmitryErshov
Obsidian | Level 7
Hello!

Why didn't you use scheduler (e.g. crontab in Linux) to execute your code ex. every 5 minutes and check for flag update?
yashpande
Obsidian | Level 7
Yes ultimately we are going to use LSF. But thats not the question. We need only 1 instance of execution and not rerun. In short only 1 infinite while loop and the moment flag value is 1 I need to break from the loop. Somehow I am not getting it.
DmitryErshov
Obsidian | Level 7

Please, provide the code of your loop.

TomKari
Onyx | Level 15

Easy, but what environment are you working in? EG, DMS, DIS?

 

Tom

Patrick
Opal | Level 21

@yashpande

As already mentioned that's something which should be done via scheduling. But to answer your question: You can use CALL SLEEP() or the SLEEP() function to pause a process for a defined amount of time. Just use this within your loop until the condition becames TRUE. 

Once TRUE just jump out of the loop (using LEAVE).

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1613 views
  • 0 likes
  • 4 in conversation