Using Macro Functions To Manipulate SAS Enterprise Guide Date Prompts Becoming A Master Manipulator Edward Lan Los Angeles County Department of Public Health Abstract In surveillance and epidemiologic functions of public health departments SAS codes are created to produce recurring reports ID: 814505
Download The PPT/PDF document "Becoming A Master Manipulator" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Becoming A Master Manipulator
Using Macro Functions To Manipulate SAS® Enterprise Guide Date Prompts
Slide2Becoming A Master Manipulator
Edward Lan
Los Angeles County Department of Public Health
Abstract
In surveillance and epidemiologic functions of public health departments, SAS codes are created to produce recurring reports. Typically, these reports will assess the status of selected reportable diseases across time periods to monitor trends, such as case counts for current month, current year, past years, yearly averages. Instead of having a separate SAS Enterprise Guide (EG) date prompt for each date value, macro functions can manipulate dates to reduce the number of prompts necessary. This paper explores using macro functions and SAS EG 7.1 date prompts to automate manipulation of date values in lieu of multiple date prompts for reports.
Objectives
Create date promptsUtilize macro functions to manipulate the dates Incorporate new dates into reports
Methods
Step 1 Create date prompts: The SAS programmer needs to assess how many sets of dates are needed to create the report and what is the minimum number of date prompts needed. For example, instead of creating 8 different prompts, we can use 4.Step 2 Create macros for dates captured from date promptUse “call symputx” statements to apply functions to the macro variablesStep 3 Apply formats to the dates to customize appearance in reportsUse %sysfunc to apply formats to the variablesStep 4 Create reports using these new dates
Results
Conclusions
Formatted new dates resulting from macros will be createdFrom 4 prompt created macro variables, we can create 10 total date variables to be used for reporting
From a few initial sets of dates, we can create a series of related dates to create a comprehensive report monitoring trends. The end user will only need to input the initial sets of dates for the prompt and the SAS code will calculate the rest!
End
s
Slide3In the example report, we can see the following dates are needed:
Current month
Current month one year agoYTD for this yearYTD for last yearLast year
2 years prior3 years prior5 year averageMain PageNext PageBecoming A Master ManipulatorEdward LanLos Angeles County Department of Public Health
Create date promptsExample report featuring multiple sets of dates`
Slide4Question: Is this too many prompts?
Main Page
Next Page
Becoming A Master ManipulatorEdward LanLos Angeles County Department of Public Health
Create date promptsXSelect your answer:
A. Yes!B. Too many!Click here to continue`
Slide5Main Page
Next Page
Becoming A Master Manipulator
Edward LanLos Angeles County Department of Public HealthInstead of 8 prompts, we can use 4!Start DateEnd DateYear Start (Average)Year End (Average)
Create date prompts
Click here to continue`
Slide6Main Page
Next Page
Becoming A Master Manipulator
Edward LanLos Angeles County Department of Public Health
&date_start&date_end&average_start&average_end
Manipulate variables
Click here to start manipulating!Click here to continue`
Slide7Main Page
Next Page
Becoming A Master Manipulator
Edward LanLos Angeles County Department of Public Health
Manipulate variablesClick here to continue
Click here to continue manipulating!`
Slide8Main Page
Next Page
Becoming A Master Manipulator
Edward LanLos Angeles County Department of Public Health
Initial variables
Resulting variables`
Slide9Main Page
Next Page
Becoming A Master Manipulator
Edward LanLos Angeles County Department of Public Health
Use them in reports!Click here to use!
01MAR2018-31MAR2018 or 01MAR 2017-31MAR201701JAN2018-31MAR2018 or 01JAN 2017-31MAR201701JAN2012-31MAR20182012-2016``
Slide10Contact Information
Edward Lan
County of Los Angeles Dept. of Public HealthTuberculosis Control Program
Email: elan@ph.lacounty.gov Main PageTitleS`