BookmarkSubscribeRSS Feed

Automating SAS using VBScript

Started ‎12-10-2015 by
Modified ‎12-10-2015 by
Views 3,640

I recently wrote a paper on automating SAS using VBScript. I wanted to share this here, as it has dozens of applications. 


VBScript and SAS are each powerful tools in their own right. These two technologies can be combined so that SAS code can call a VBScript program or vice versa. This gives a programmer the ability to automate SAS tasks, traverse the file system, send emails programmatically, manipulate Microsoft® Word, Excel, and PowerPoint files, get web data, and more. This paper presents example code to demonstrate each of these capabilities.


If you like it, please check out my other papers, downloads, and subscribe to my free bimonthly e-magazine.





An interesting article, thanks for sharing.  I would point out two things however:

With VBScripting, there are a few considerations.  Firstly you can seriously damage your system/filesystem etc. if things go wrong, this is one of the main reason why X command is sometimes denied bythe IT group.  I wouldn't want to see novice users writing scripts to do things when they either don't understand it, or don't follow appropriate procedures - testing, documentation etc.  It can be quite dangerous.  Also, I have had it before where a vendor sends through a project which includes scripts calling VBAscripts and they fail, different versions or missing components etc.  Robustness should be at the forefront of development.


Secondly need.  With the office applications they already have VBA embedded in them.  Often we have these questions of how to update a pre-existing file with new data.  My answer is always to write VBA code to import a CSV file and process it into the spreadsheet.  This is very simple code and can be stored in the same file.  Just reduces the number of technologies needed.  Of course in an ideal world you wouldn't be using office for anything anyways, use a proper report format or data transfer format and that solves all these issues straight away.  The reliance on Excel (in particular) is one of the biggest holes in technology worldwide.


Version history
Last update:
‎12-10-2015 03:59 PM
Updated by:


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!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags