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.
Thanks,
Chris
chris@codeitmagazine.com
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.
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!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.