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.  

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

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.  

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

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
  • 1 reply
  • 262 views
  • 0 likes
  • 2 in conversation