How to Optimize Existing SAS - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

How to Optimize Existing SAS

Description:

call symput('YY', put(dmfirst, year2.)); %put _user_; Step-By-Step Guide. Create all new folders ... How to automatically create new data set in the beginning ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 19
Provided by: TEO74
Category:

less

Transcript and Presenter's Notes

Title: How to Optimize Existing SAS


1
How to Optimize Existing SAS Programsfor
Generating Standard Reports
  •  
  • Teo Gamishev
  • Office of Research and Statistics Columbia, SC

2
Whats in this topic?
  • Most common practice on generating Standard
    Reports
  • Is that a problem and how to get out of it?
  • What is the advantage of Optimization?
  • Step-By-Step Guide

3
Most common practice on generating Standard
Reports
  • The basic steps of generating standard reports
    include all or some of the following processes
  • Generating data extracts
  • Downloading the extracts
  • Importing the data into SAS
  • Updating the existing database
  • Generating the Reports

4
Most common practice on generating Standard
Reports
  • Open the existing SAS program to change
  • numerous dates
  • variable names
  • data set names
  • file names
  • titles
  • Submit each one program
  • Check for errors and move to the next program

5
Is that a problem?
  • Somebody may try to convince you that this job
    is
  • very inspiring
  • very creative
  • makes you happy
  • takes a Bachelor or Master degree to get it?

6
How to get out of that situation?
  • Use the available SAS tools to automate the
    process of updating the programs, completely
  • In this presentation youll find just one of many
    affordable ways to do it

7
What is the advantage of Optimization?
  • By applying that method, the time for just one
  • of the standard report processes, has been
    reduced
  • from 13 hours programmers time to 3 clicks
  • of the mouse.
  •  
  • The overall outcome is creating
  • ERROR FREE
  • standard reports for a significantly shorter
    time.
  •  
  • The programmer is focused on
  • quality control and researching the data.

8
 Step-By-Step Guide
  • Step One Creating driving SAS program(s)
  • Step Two Modifying the existing SAS programs
  •  
  • What do you need to know?-The places within the
    programs, where the changes occur.
  •  
  • You dont need to have a deep knowledge about the
    logic within the programs.

9
Step-By-Step Guide Step One Creating DRIVING
SAS Programs
  • A simple approach suggests grouping all programs
    performing a similar task.
  •  
  • Example
  • All JCL/SAS programs, generating the extracts on
    the Mainframe
  • All SAS programs, importing the data files into
    SAS tables
  • All SAS programs updating the main database(s)
  • All SAS programs, generating the Reports

10
Step-By-Step Guide Step One Creating DRIVING
SAS Programs
  • Create a new SAS Program DRIVING code
  • The purpose of the DRIVING code is
  • generate all macro variables youll need for the
    programs within that particular group
  • create all new folders to export data or reports
  • trigger all SAS programs within the same group

11
Step-By-Step Guide Generate all macro variables
youll need for the programs within that
particular group
  • Example
  • LET DATAMONTH 01mar2008 Your
    typing ends here!!!
  • Data _null_
  • first day of the data month
  • dmfirst INTNX ('month',DATAMONTHd,0)
  • last day of the data month
  • dmlast INTNX ('month',DATAMONTHd,0,'end')
  •  
  • oylast INTNX ('month', dmfirst,-12)
  • oylast INTNX ('month', dmfirst,-12,'end')
  •  
  • BAD EXAMPLE
  • dmfirst INTNX('month',today(),-1)
  • dmlast INTNX('month',today(),-1,'end')

12
Step-By-Step Guide Generate all macro variables
youll need for the programs within that
particular group
  • Example
  •  
  • call symput('DMFD',put((dmfirst),DATE9.))
  • call symput('BDMN',trim(left(put((bdmlast),
    MONNAME.))))
  • call symput('CMFD', trim(left(put((cmfirst),
    DAY.))))
  • call symput('YBDY', put((bdmlast), YEAR4.))
  • call symput('DMMYY', put((dmfirst), MONYY5.))
  • call symput('MM', put(month(dmlast), z2.))
  • call symput('YY', put(dmfirst, year2.))
  • put _user_

13
Step-By-Step GuideCreate all new folders
  • Example
  •  
  • FILENAME lynn PIPE "mkdir ""E\DSP\ReportsDMMYY."
    ""
  • data _null_
  • infile lynn
  • run
  •  
  •  
  • Trigger all SAS programs within the same group
  •  
  • Example
  •  
  • include 'E\DSP\cap\Programs\01a.sas'
  • include 'E\DSP\cap\Programs\01a_pt2.sas'

14
Step-By-Step Guide Step Two Modifying the
existing SAS programs
  • replace all dates, variable names, datasets names
    and titles with the macro variables created
    within the DRIVING program
  • create destination for the outputs/logs and
    redirect the output using
  • PROC PRINTTO for text files
  • ODS.TAGSET for Excel files

15
Step-By-Step Guide Step Two Modifying the
existing SAS programs
  • Now is the time to solve all of the challenges
    like
  •  
  • How to update the JCL/SAS programs from SAS
  • How to automate the data downloading process
  • How to control the flow of the SAS program
  • How to create custom time periods, like fiscal or
    state years
  • How to automatically create new data set in the
    beginning of the new time period
  • How to generate custom date FORMATs and INFORMATs
  • How to read large number of datasets located in
    the same folder
  • How to clean variables from bugs
  • How to zip the data or the reports from within
    SAS
  • How to clean the temp data and the macro
    variables

16
The Trigger ProgramTHE RUNNER
17
  Thank you
  • References
  • How to Optimize Existing SAS Programs for
    Generating Standard Reports, Teo Gamishev
  •  
  • Affordable SAS Tips, Teo Gamishev
  •  
  • Look for the articles in the membership area,
  • coming next month!

18
South Carolina SAS Users Group
Write a Comment
User Comments (0)
About PowerShow.com