BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
saikiran_nemani
Obsidian | Level 7

Dear Everyone,

 

I have a task that after excel gets updated it should automatically run SAS Code.

 

Is there any way that I can do it.

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
Super User

Probably not easily... 

 

Can you explain more of the process?  What or who is updating the Excel file, is a person updating it or is there an automated process updating the Excel file?  

 

If an automated process is updating the Excel file, then probably you would want to add a step to that process so that after it updates the Excel file, it invokes a SAS job.

 

If a person is updating the Excel file, then I can imagine two options.  I'm sure there are more.  I'm going to assume that update means saves the .xlsx file.

 

You could have a scheduled SAS job (or a powershell job or whatever) that runs every hour (or 10 minutes), and checks the modified date-time of the Excel file to decide if it should process the file. 

 

If you're an excel / VBA  / powershell person, you could build an excel  button that an Excel user could click, that would execute the Excel save command and then invoke a SAS job.  So the user would be responsible for clicking that button. If you have SAS add-on for Microsoft Office, a button like that might be built in.

 

There are lots of complexities I don't address here.  For example, this assumes your Excel file is on a computer that can see your SAS environment, and vice versa.  

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

View solution in original post

1 REPLY 1
Quentin
Super User

Probably not easily... 

 

Can you explain more of the process?  What or who is updating the Excel file, is a person updating it or is there an automated process updating the Excel file?  

 

If an automated process is updating the Excel file, then probably you would want to add a step to that process so that after it updates the Excel file, it invokes a SAS job.

 

If a person is updating the Excel file, then I can imagine two options.  I'm sure there are more.  I'm going to assume that update means saves the .xlsx file.

 

You could have a scheduled SAS job (or a powershell job or whatever) that runs every hour (or 10 minutes), and checks the modified date-time of the Excel file to decide if it should process the file. 

 

If you're an excel / VBA  / powershell person, you could build an excel  button that an Excel user could click, that would execute the Excel save command and then invoke a SAS job.  So the user would be responsible for clicking that button. If you have SAS add-on for Microsoft Office, a button like that might be built in.

 

There are lots of complexities I don't address here.  For example, this assumes your Excel file is on a computer that can see your SAS environment, and vice versa.  

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 500 views
  • 0 likes
  • 2 in conversation