Automating SAS through the Power of VB Script

Slides:



Advertisements
Similar presentations
CC SQL Utilities.
Advertisements

Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
1 Appendix A: Writing and Submitting SAS ® Programs A.1 Writing and Submitting SAS Programs.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Week 6 - Programming I So far, we’ve looked at simple programming via “scripts” = programs of sequentially evaluated commands Today, extend features to:
Program Design and Development
Division Example 2x - 3y + 4z = 10 x + 6y - 3z = 4 -5x + y + 2z = 3 A*X = B where A = B = >> X = A\B X =
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to Python Programming Outline 2.1 Introduction 2.2 First Program in Python: Printing.
Chapter 4 MATLAB Programming Logical Structures Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
SmartLog X 3 TEAM Basic SmartLog X 3 TEAM Basic DescoEMIT.com USER STATUS USER EDIT TEST LOG ADMIN TEST MACHINE SCHEDULE INSTALL System Requirements:
Chapter 4 MATLAB Programming Combining Loops and Logic Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Javascript and the Web Whys and Hows of Javascript.
CS140: Intro to CS An Overview of Programming in C by Erin Chambers.
TEAM Basic TotalElectrostatic ManagementAwareness&
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 5 – Dental Payment Application: Introducing.
Batch processing and sysparm A step towards scheduling.
Macro Overview Mihaela Simion. Macro Facility Overview Definition : The SAS Macro Facility is a tool within base SAS software that contains the essential.
Using Visual Basic for Applications in Microsoft Project Sean Vogel.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
Session Making Queries and Multiple Entry Work for You in Direct Loans (Hands-On) Session 21.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Adding attachments to s This power point is to help people to know what an attachment is and also I will show you how to do it with screen shots to.
PHP Error Handling Section :I Source: 1.
Trinity College Dublin, The University of Dublin GE3M25: Computer Programming for Biologists Python Karsten Hokamp, PhD Genetics TCD, 03/11/2015.
While You Were Sleeping… SAS Is Hard At Work Andrea Wainwright- Zimmerman.
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
9/21/04 James Gallagher Server Installation and Testing: Hands-on ● Install the CGI server with the HDF and FreeForm handlers ● Link data so the server.
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
Advanced Informer Features
PHP using MySQL Database for Web Development (part II)
Scheduling Reports in BOXI 4.2
Development Environment
Advantages of sas for reporting
Scheduled Report ing From CounterPoint.
Bash Introduction (adapted from chapters 1 and 2 of bash Cookbook by Albing, Vossing, & Newham) CPTE 440 John Beckett.
SQL and SQL*Plus Interaction
ECE Application Programming
Control Flow Constructs: Conditional Logic
Loops BIS1523 – Lecture 10.
Customer Online Ordering
Matlab Training Session 4: Control, Flow and Functions
PROCEDURES, CONDITIONAL LOGIC, EXCEPTION HANDLING, TRIGGERS
Chapter 4 MATLAB Programming
Automated Docketing With the ADI Wizard for Bankruptcy Courts
Life Cycle Objectives By James Lee and Matt Higgins
Cost Collections Using DOS CC Interface
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Cover page.
Conditions and Ifs BIS1523 – Lecture 8.
Exploring Microsoft Excel
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
C Preprocessor(CPP).
Exploring the Power of EPDM Tasks - Working with and Developing Tasks in EPDM By: Marc Young XLM Solutions
Work Order System Infor 10 (EAM) JCIM
Stay Connected to Work Away from Work: A Simple Approach to Send s from SAS® using VBScript Paper #
Dependency Macro Ensuring data reliability in healthcare analytics
Python programming exercise
Detecting Runtime Errors and Exiting from Nested Macros Gracefully
Purpose Real life scenario: I have a set of reports to refresh every month but data is only available at any day during Day 3 – 5 at beginning of each.
Passing Simple and Complex Parameters In and Out of Macros
Matthew Slaughter is Research Analyst at the Kaiser Permanente Center for Health Research in Portland, OR. He provides programming, analytical, and data.
IPC144 Introduction to Programming Using C Week 4 – Lesson 2
September 12-14, 2018 Raleigh, NC.
Introduction to Bash Programming, part 3
Tips and Tricks for Using Macros to Automate SAS Reporting.
SSRS – Thinking Outside the Report
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

Automating SAS through the Power of VB Script

Outline VB Script Custom Log Task Scheduler Job Streams – Daily, Weekly, Monthly Input Files Email Automation

What is VB Script? Scripting Language Automation capabilities

Running SAS From Command Prompt Required SAS Location Code Location Optional Log Location Output Location

Running SAS From Command Prompt “<SAS location> -sysin <code location> -print <output location> -log <log location>”

VB Script “<SAS location> -sysin <code location> -print <output location> -log <log location>”

Custom Log Creation No auto-generated log for VB Script OpenTextFile function Log file location 1-reading, 2-writing, 8-appending True-create, false-don’t WriteLine function

Task Scheduler

Task Scheduler Required Optional General Triggers Actions Conditions Settings

Task Scheduler Required Optional General Triggers Actions Conditions Settings

Task Scheduler Required Optional General Triggers Actions Conditions Settings

SAS Job Streams – Daily Simple %inc statement needed. %inc 'C:\Data\Conference_Paper\Automated SAS Code\Daily\Subcode_1.sas'; %inc "C:\Data\Conference_Paper\Automated SAS Code\Daily\Subcode_2.sas"; %inc "C:\Data\Conference_Paper\Automated SAS Code\Daily\Subcode_3.sas"; Simple %inc statement needed. Can have multiple set up to run daily. As long as main code is set up to run subcodes will also run. NOTE: If your line of code contains a macro variable it will require double quotes.

SAS Job Streams – Weekly %SYSFUNC – macro function that allows code to evaluate SAS functions TODAY() – SAS function will return the value of today. If no format is specified it will show the number of days since January 1, 1960 WEEKDAY() – SAS function that outputs a value from 1 to 7 for the current day of week, e.g. 4 for Wednesday

SAS Job Streams – Monthly Day()- SAS function that returns the day of the month. Above code shows logic to kick off jobs on the 1st day of the month or the 26th day of the month.

Input Files Filename(fileref,file_name) data _null_; Fopen(fileref) Finfo(varname,option) Today() %Macro CheckFile; data _null_; dummy=filename('fle',"C:\Data\Conference_Paper\test.txt"); fid=fopen('fle'); mdfy=finfo(fid,'Last Modified'); mdfydte=input(mdfy,datetime.); today=today()*24*60*60; if fid=0 then filesready=2; else if mdfydte >= today then filesready=1; else filesready=0; call symput('filesready', filesready); run; %mend;

Input Files &filesready 1=good 0=old 2=doesn’t exist

Input Files &filesready 1=good 0=old 2=doesn’t exist

Automate Emails SAS function FILENAME -allows SAS to send an email electronically. &syscc =0 if successful &syscc =4 if there were warnings &syscc all other values if errors. creation of the &syscc_old macro variable allows jobs to continue running.

Automate Emails –Cont. Within each email code you can add to:, cc:, subject: and the attachment. Put statements allow for further detail.

Automate Emails –Cont. Adjust config file Config file is a text file named SASV9.CFG and will be saved in the same spot where SAS is installed config might change depending on the email server used on your computer.

Conclusion Improve Automated Processes by: Kick off SAS using VB script and a task scheduler Custom Log Run Daily, Weekly, and Monthly Jobs Check for input files Email automation

Contact Information Name: Lindsey Whiting Company: Kohler Co. City/State: Kohler, Wisconsin Phone:920-457-4442 x72745 Email: Lindsey.Whiting@kohler.com

Contact Information Name: Joey Kaiser Company: Kohler Co. City/State: Kohler, Wisconsin Phone:920-457-4442 x70503 Email: Joseph.Kaiser@kohler.com