Macros are a block of code that can be executed/called on demand
|
|
- Roberta Ray
- 6 years ago
- Views:
Transcription
1
2
3 What Are These
4 Macros are a block of code that can be executed/called on demand
5 Global variables are variables that you assign a value to, which can be referenced anywhere within your program. (Leah s definition) Think the proper name for them is: Global Macro Variables
6 Why Use Them
7
8 Macros: Allow for complex, robust, dynamic coding When you have code that is used repeatedly within a program itself or within a project One instance ensures you have the latest version of the code Keeps code neat and tidy
9 Macro Variables: Allows for more dynamic, iterative programming If a variable appears in various parts of your code, changing it in 1 place ensures all instances of it will be updated. Great for use in Reporting - Titles and Footnotes
10 Example of how I use macros: Very Basic: Reading in a series of flat files - write the code only once - execute as many times as needed
11 %MACRO FILEREAD; DATA T1(KEEP=VAR1 VAR2 VAR3); INFILE "/SAS_data/pathname/morepathname/&FLNAME..dat" LRECL=2916 MISSOVER PAD EOF=LAST; var1 var2 var3 $CHAR3.; %MEND FILEREAD; %LET FLNAME=y0708/y0708; %FILEREAD; %LET FLNAME=y0809/y0809; %FILEREAD;
12 Components of a Macro: Starts with: %macro macro_name; Ends with: %mend macro_name; Is invoked/called by: %macro_name;
13 %MACRO FILEREAD; DATA T1(KEEP=VAR1 VAR2 VAR3); INFILE "/SAS_data/pathname/morepathname/&FLNAME..dat" LRECL=2916 MISSOVER PAD EOF=LAST; var1 var2 var3 $CHAR3.; %MEND FILEREAD; %LET FLNAME=y0708/y0708; %FILEREAD; %LET FLNAME=y0809/y0809; %FILEREAD;
14 Global Macro Variable: %Let var_name = value Eg: %LET FLNAME=y0708/y0708; Referenced by: &var_name
15 Important to note: These value of the variable is exactly what you set it to be. Eg: %let x = A; %let x = A ; These variables are not kept in a dataset.
16 %MACRO FILEREAD; DATA T1(KEEP=VAR1 VAR2 VAR3); INFILE "/SAS_data/pathname/morepathname/&FLNAME..dat" LRECL=2916 MISSOVER PAD EOF=LAST; var1 var2 var3 $CHAR3.; %MEND FILEREAD; %LET FLNAME=y0708/y0708; %FILEREAD; %LET FLNAME=y0809/y0809; %FILEREAD;
17 /* GLOBAL VARIABLES */ %LET FROMDT=MDY(01,01,1985); /* FORMAT MONTH,DAY,YEAR */ %LET TODT=MDY(03,31,2008); /* FORMAT MONTH,DAY,YEAR */ %LET SLCTTYPE=3; /* 1=MALE, 2=FEMALE, 3=BOTH */ %LET DT4SLCTN='B'; /* A=ADMIT, D=DISCH, B=BOTH */ %LET CODEICD=25; /* 0-25 ARE VALID FOR */ %LET CODEPROC=20; /* 0-20 ARE VALID FOR */ %LET SLCTALL=0; /* 1=SELECT ALL RECS REGARDLESS OF CATEGORIZING THEM */ %LET TYPEWANT=%STR(('M' '1' '2' '3' '6' '9' ' '));
18 /* DETERMINE IF DATE IS BETWEEN WANTED DATES */ IF &DT4SLCTN='A' THEN DO; IF ADMIT_DT < &FROMDT OR ADMIT_DT > &TODT THEN DO; DATEDEL=DATEDEL+1; DELETE; END; END; ELSE IF &DT4SLCTN='D' THEN DO; IF DISCH_DT < &FROMDT OR DISCH_DT > &TODT THEN DO; DATEDEL=DATEDEL+1; DELETE; END; END; ELSE DO; IF DISCH_DT < &FROMDT OR ADMIT_DT > &TODT THEN DO; DATEDEL=DATEDEL+1; DELETE; END; END; /* DETERMINE IF SEX = SELECTION TYPE */ IF SEX IN ('1' '3' 'M') THEN SEX1=1; ELSE SEX1=2; IF &SLCTTYPE IN (1 2) AND SEX1 NE &SLCTTYPE THEN DO; SEXDEL=SEXDEL+1; DELETE; END;
19 /* DETERMINE WHICH MACRO TO RUN BASED ON ICD CODING */ IF IC10D1 > ' ' THEN DO; %ICD10PROC; END; ELSE DO; %ICD9PROC; END;
20 %MACRO ICD9PROC; J = 1; DO UNTIL (J > 25); /* DETERMINE IF RECORD IS TO BE SELECTED */ IF J LE &CODEICD AND TYPE{J} IN %STR(&TYPEWANT) THEN ICDWANT=1; END; ELSE DO; END; END; %MEND ICD9PROC; TYPEO{J}=' '; ICDFMT{J}=' ';
21 Variation on the theme
22 %MACRO FILEREAD(FLNAME); DATA T1(KEEP=VAR1 VAR2 VAR3); INFILE "/SAS_data/pathname/morepathname/&FLNAME..dat" LRECL=2916 MISSOVER PAD EOF=LAST; var1 var2 var3 $CHAR3.; %MEND FILEREAD; %FILEREAD(y0708/y0708); %FILEREAD(y0809/y0809);
23 Conditional Programming In A Macro Outside of Regular Data/Proc Statements
24 Like basic SAS programming but use the % before each word %if, %then, %do
25 %macro xtr(year,type); %let sufx= ; *Note: this equates to a null value; %if (&type = main and ((&year = 0102) or (&year = 0203) %then %let sufx=a; data s1; set s&year..&type&year&sufx ; date = dos-1; *Adjusted SAS date to Perpetual from Health Perpetual; if amt_app NE. and dos GE &strdate. and dos LT &enddate. AND (diag IN(&slctdiag.)) ; proc append base=&result data=s1 force; proc delete data=s1; run; %mend; /*** Macro calls to stats files ***/ %xtr(year=1415,type=main);
26 More Examples
27 %let input = data.t201602; %let effdate = ; %let fiscal = '01Apr2016'd; %let year = 2016; %let month = 06; * Specify the fields required in the report; %let fields= run_cd, rx_ddddd, drg_type, hsn variable list.; * Call the creation macro and create the source data file; %creation (&input) %let source=source; * Invoke the ReportX program; %include '/SAS_data/drugplan/Data/Production/ReportX.sas'; run;
28 %macro creation(quarter); proc sql; create table new as select &fields from &quarter; quit; proc append base=source data=new force; run; proc sql; drop table new; quit; %mend;
29 * Create table - - Males Report X; %let sex = 'M'; %let cov = 1; %let infile = output; %let outfile = '/SAS_data/path/name/ReportX1M.asc'; %include '/SAS_data/path/name/Programs/ReportXExport.sas'; * Create table - - Females Report X; %let sex = 'F'; %let cov = 1; %let infile = output; %let outfile = '/SAS_data/path/name/ReportX1F.asc'; %include '/SAS_data/path/name/Programs/ReportXExport.sas'; * Create table - - All Report X; %let sex = sex; %let cov = 1; %let infile = output; %let outfile = '/SAS_data/path/name/ReportX1All.asc'; %include '/SAS_data/path/name/Programs/ReportXExport.sas';
30 ReportXExport.sas proc sql; create table output as select * from getdata where cov = &cov and sex = &sex; quit; Data _null_; set &infile; file &outfile; put ; Run;
31 %let pct=0.034; %let pcta= 3.4%'; Data T1; set x; threshhold=5*ceil((calc_income*&pct/2)/5); dmc=round((calc_income*&pct)/12,.01); Run; *outputting results in log; data _null_; set T1; 'Output for ' &pcta;
32
33 %let startno = 1; %let endno = 3; %macro printvar; data _null_; array test (2) test1-test2; do i = &startno to &endno; test(i) = i; end; run; %mend printvar; %printvar; run;
34 17 %let startno = 1; 18 %let endno = 3; %macro printvar; data _null_; array test (2) test1-test2; do i = &startno to &endno; 27 test(i) = i; 28 end; 29 run; %mend printvar; %printvar; ERROR: Array subscript out of range at line 33 column 85. test1=1 test2=2 i=3 _ERROR_=1 _N_=1 NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
35 Options for Debugging: SYMBOLGEN/NOSYMBOLGEN - displays of value of the variables MPRINT/NOMPRINT - shows what the compiler receives MLOGIC/NOMLOGIC - displays tracing of macro execution.
36 options symbolgen; %let startno = 1; %let endno = 3; %macro printvar; data _null_; array test (2) test1-test2; do i = &startno to &endno; test(i) = i; end; run; %mend printvar; %printvar; run;
37 15 options symbolgen; %let startno = 1; 18 %let endno = 3; %macro printvar; data _null_; array test (2) test1-test2; do i = &startno to &endno; 27 test(i) = i; 28 end; 29 run; %mend printvar; %printvar; SYMBOLGEN: Macro variable STARTNO resolves to 1 SYMBOLGEN: Macro variable ENDNO resolves to 3 ERROR: Array subscript out of range at line 33 column 85. test1=1 test2=2 i=3 _ERROR_=1 _N_=1
38 15 options mprint; %let startno = 1; 18 %let endno = 3; %macro printvar; data _null_; array test (2) test1-test2; do i = &startno to &endno; 27 test(i) = i; 28 end; 29 run; %mend printvar; %printvar; MPRINT(PRINTVAR): data _null_; MPRINT(PRINTVAR): array test (2) test1-test2; MPRINT(PRINTVAR): do i = 1 to 3; MPRINT(PRINTVAR): test(i) = i; MPRINT(PRINTVAR): end; MPRINT(PRINTVAR): run; ERROR: Array subscript out of range at line 33 column 85. test1=1 test2=2 i=3 _ERROR_=1 _N_=1
39 15 options mlogic; %let startno = 1; 18 %let endno = 3; %macro printvar; data _null_; array test (2) test1-test2; do i = &startno to &endno; 27 test(i) = i; 28 end; 29 run; %mend printvar; %printvar; MLOGIC(PRINTVAR): Beginning execution. ERROR: Array subscript out of range at line 33 column 85. test1=1 test2=2 i=3 _ERROR_=1 _N_=1 NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds MLOGIC(PRINTVAR): Ending execution.
40 15 options symbolgen mprint mlogic; %let startno = 1; 19 %let endno = 3; MLOGIC(PRINTVAR): Beginning execution. MPRINT(PRINTVAR): data _null_; MPRINT(PRINTVAR): array test (2) test1-test2; SYMBOLGEN: Macro variable STARTNO resolves to 1 SYMBOLGEN: Macro variable ENDNO resolves to 3 MPRINT(PRINTVAR): do i = 1 to 3; MPRINT(PRINTVAR): test(i) = i; MPRINT(PRINTVAR): end; MPRINT(PRINTVAR): run; ERROR: Array subscript out of range at line 34 column 85. test1=1 test2=2 i=3 _ERROR_=1 _N_=1 NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds MLOGIC(PRINTVAR): Ending execution.
41
42
43 References: Online support.sas.com documentation Steven First & Katie Ronk, SAS Macro Variables and Simple Macro Programs Paper ,
Debugging. Where to start? John Ladds, SAS Technology Center, Statistics Canada.
Debugging Where to start? John Ladds, SAS Technology Center, Statistics Canada Come out of the desert of ignorance to the OASUS of knowledge Did it work? I don t see any red. So it must have worked, right?
More informationAn Introduction to Macros Deb Cassidy
Paper #HW03 An Introduction to Macros Deb Cassidy Abstract A search in the proceedings for SUGI 24-28 for the word "macro" had over 1,000 hits. Why are macros so popular? A quick glance through the papers
More informationSandra Hendren Health Data Institute
INTRODUCTION TO THE MACRO LANGUAGE Sandra Hendren Health Data Institute The purpose of this paper is to explain the macro language at a conceptual level. It will not discuss the syntax of the language
More informationBase and Advance SAS
Base and Advance SAS BASE SAS INTRODUCTION An Overview of the SAS System SAS Tasks Output produced by the SAS System SAS Tools (SAS Program - Data step and Proc step) A sample SAS program Exploring SAS
More informationDSCI 325: Handout 15 Introduction to SAS Macro Programming Spring 2017
DSCI 325: Handout 15 Introduction to SAS Macro Programming Spring 2017 The Basics of the SAS Macro Facility Macros are used to make SAS code more flexible and efficient. Essentially, the macro facility
More informationSeminar Series: CTSI Presents
Biostatistics, Epidemiology & Research Design (BERD) Howard Cabral, PhD, MPH Christine Chaisson, MPH Seminar Series: CTSI Presents November 20, 2014 Demystifying SAS Macros BUSPH Data Coordinating Center
More informationUnlock SAS Code Automation with the Power of Macros
SESUG 2015 ABSTRACT Paper AD-87 Unlock SAS Code Automation with the Power of Macros William Gui Zupko II, Federal Law Enforcement Training Centers SAS code, like any computer programming code, seems to
More informationSimplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA
PharmaSUG 2017 BB07 Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA ABSTRACT One often uses an iterative %DO loop to execute a section of a macro
More informationA Macro that can Search and Replace String in your SAS Programs
ABSTRACT MWSUG 2016 - Paper BB27 A Macro that can Search and Replace String in your SAS Programs Ting Sa, Cincinnati Children s Hospital Medical Center, Cincinnati, OH In this paper, a SAS macro is introduced
More informationA SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY
PharmaSUG 2014 - Paper BB14 A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY ABSTRACT Clinical Study
More information1 Files to download. 3 Macro to list the highest and lowest N data values. 2 Reading in the example data file
1 2 22S:172 Lab session 10 Macros for data cleaning July 17, 2003 GENDER VISIT HR SBP DBP DX AE = "Gender" = "Visit Date" = "Heart Rate" = "Systolic Blood Pressure" = "Diastolic Blood Pressure" = "Diagnosis
More informationSTAT:5400 Computing in Statistics. Other software packages. Microsoft Excel spreadsheet very convenient for entering data in flatfile
STAT:5400 Computing in Statistics Other Software Packages Proc import A bit on SAS macro language Lecture 26 ov 2, 2016 Kate Cowles 374 SH, 335-0727 kate-cowles@uiowaedu Other software packages Microsoft
More informationSURVIVING THE SAS MACRO JUNGLE BY USING YOUR OWN PROGRAMMING TOOLKIT
PharmaSUG 2016 Paper BB11 SURVIVING THE SAS MACRO JUNGLE BY USING YOUR OWN PROGRAMMING TOOLKIT KEVIN RUSSELL Photo credit: Geoff Gallice / CC by 2.0 TOOLS FOR YOUR MACRO PROGRAMMING TOOLKIT The DOSUBL
More informationPaper CC16. William E Benjamin Jr, Owl Computer Consultancy LLC, Phoenix, AZ
Paper CC16 Smoke and Mirrors!!! Come See How the _INFILE_ Automatic Variable and SHAREBUFFERS Infile Option Can Speed Up Your Flat File Text-Processing Throughput Speed William E Benjamin Jr, Owl Computer
More informationFoundations and Fundamentals. SAS System Options: The True Heroes of Macro Debugging Kevin Russell and Russ Tyndall, SAS Institute Inc.
SAS System Options: The True Heroes of Macro Debugging Kevin Russell and Russ Tyndall, SAS Institute Inc., Cary, NC ABSTRACT It is not uncommon for the first draft of any macro application to contain errors.
More informationA SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes
A SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes Brian E. Lawton Curriculum Research & Development Group University of Hawaii at Manoa Honolulu, HI December 2012 Copyright 2012
More informationOut of Control! A SAS Macro to Recalculate QC Statistics
Paper 3296-2015 Out of Control! A SAS Macro to Recalculate QC Statistics Jesse Pratt, Colleen Mangeot, Kelly Olano, Cincinnati Children s Hospital Medical Center, Cincinnati, OH, USA ABSTRACT SAS/QC provides
More informationERROR: ERROR: ERROR:
ERROR: ERROR: ERROR: Formatting Variables: Back and forth between character and numeric Why should you care? DATA name1; SET name; if var = Three then delete; if var = 3 the en delete; if var = 3 then
More informationSAS Institute Exam A SAS Advanced Programming Version: 6.0 [ Total Questions: 184 ]
s@lm@n SAS Institute Exam A00-212 SAS Advanced Programming Version: 6.0 [ Total Questions: 184 ] Question No : 1 The report will not successfully run and will produce an error message in the log. What
More informationUnderstanding the Concepts and Features of Macro Programming 1
Contents Preface ix Acknowledgments xi Part 1 Understanding the Concepts and Features of Macro Programming 1 Chapter 1 Introduction 3 What Is the SAS Macro Facility? 4 What Are the Advantages of the SAS
More informationSAS CURRICULUM. BASE SAS Introduction
SAS CURRICULUM BASE SAS Introduction Data Warehousing Concepts What is a Data Warehouse? What is a Data Mart? What is the difference between Relational Databases and the Data in Data Warehouse (OLTP versus
More informationA Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA
Paper PO26 A Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA Abstract: Imagine that you are working on a study (project) and you would like to generate a report for the status
More informationA Tutorial on the SAS Macro Language
HW152 SESUG 2015 A Tutorial on the SAS Macro Language John J. Cohen, Advanced Data Concepts LLC, Newark, DE ABSTRACT The SAS Macro language is another language that rests on top of regular SAS code. If
More informationSAS seminar. The little SAS book Chapters 3 & 4. April 15, Åsa Klint. By LD Delwiche and SJ Slaughter. 3.1 Creating and Redefining variables
SAS seminar April 15, 2003 Åsa Klint The little SAS book Chapters 3 & 4 By LD Delwiche and SJ Slaughter Data step - read and modify data - create a new dataset - performs actions on rows Proc step - use
More informationDemystifying Inherited Programs
Demystifying Inherited Programs Have you ever inherited a program that leaves you scratching your head trying to figure it out? If you have not, chances are that some time in the future you will. While
More informationElectricity Forecasting Full Circle
Electricity Forecasting Full Circle o Database Creation o Libname Functionality with Excel o VBA Interfacing Allows analysts to develop procedural prototypes By: Kyle Carmichael Disclaimer The entire presentation
More informationWhy & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools
Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools LeRoy Bessler PhD Bessler Consulting and Research Strong Smart Systems Mequon, WI, USA Le_Roy_Bessler@wi.rr.com
More information&&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates
&&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates INTRODUCTION SAS macros are powerful tools that can create reusable code modules to do a variety of programming
More informationAcquisition and Management of Market Data for SAS Risk Dimensions
Acquisition and Management of Market Data for SAS Risk Dimensions Shankar Yaddanapudi, SAS Consultant, Washington DC ABSTRACT SAS Risk Dimensions is an Enterprise Risk Management solution to help financial
More informatione. That's accomplished with:
Make Your Life a Little Easier: A Collection of SAs Macro Utilities Pete Lund, Northwest Crime and Social Research, Olympia, WA ABSTRACT SAs Macros are used in a variety of ways: to automate the generation
More informationMake Your Life a Little Easier: A Collection of SAS Macro Utilities. Pete Lund, Northwest Crime and Social Research, Olympia, WA
Make Your Life a Little Easier: A Collection of SAS Macro Utilities Pete Lund, Northwest Crime and Social Research, Olympia, WA ABSTRACT SAS Macros are used in a variety of ways: to automate the generation
More informationHow to use UNIX commands in SAS code to read SAS logs
SESUG Paper 030-2017 How to use UNIX commands in SAS code to read SAS logs James Willis, OptumInsight ABSTRACT Reading multiple logs at the end of a processing stream is tedious when the process runs on
More informationGoing Under the Hood: How Does the Macro Processor Really Work?
Going Under the Hood: How Does the Really Work? ABSTRACT Lisa Lyons, PPD, Inc Hamilton, NJ Did you ever wonder what really goes on behind the scenes of the macro processor, or how it works with other parts
More informationYour Own SAS Macros Are as Powerful as You Are Ingenious
Paper CC166 Your Own SAS Macros Are as Powerful as You Are Ingenious Yinghua Shi, Department Of Treasury, Washington, DC ABSTRACT This article proposes, for user-written SAS macros, separate definitions
More informationGetting Classy: A SAS Macro for CLASS Statement Automation
Getting Classy: A SAS Macro for CLASS Statement Automation ABSTRACT When creating statistical models that include multiple covariates, it is important to address which variables are considered categorical
More informationABSTRACT INTRODUCTION THE GENERAL FORM AND SIMPLE CODE
Paper SA06 Painless Extraction: Options and Macros with PROC PRESENV Keith Fredlund, MS (candidate) Grand Valley State University, Allendale, Michigan; Thinzar Wai, MS (candidate) Grand Valley State University,
More informationContents of SAS Programming Techniques
Contents of SAS Programming Techniques Chapter 1 About SAS 1.1 Introduction 1.1.1 SAS modules 1.1.2 SAS module classification 1.1.3 SAS features 1.1.4 Three levels of SAS techniques 1.1.5 Chapter goal
More informationText Generational Data Sets (Text GDS)
Paper 274-2017 Text Generational Data Sets (Text GDS) Dr. Kannan Deivasigamani HSBC ABSTRACT This paper offers a way to fill the void that SAS currently has with respect to the missing feature in the language,
More informationTOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE
TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE Handy Tips for the Savvy Programmer SAS PROGRAMMING BEST PRACTICES Create Readable Code Basic Coding Recommendations» Efficiently choosing data for processing»
More informationMimicking the Data Step Dash and Double Dash in PROC SQL Arlene Amodeo, Law School Admission Council, Newtown, PA
ABSTRACT Mimicking the Data Step Dash and Double Dash in PROC SQL Arlene Amodeo, Law School Admission Council, Newtown, PA The SQL procedure is a powerful and versatile procedure in SAS that allows the
More informationPLA YING WITH MACROS: TAKE THE WORK OUT OF LEARNING TO DO MACROS. Arthur L. Carpenter
PLA YING WITH MACROS: TAKE THE WORK OUT OF LEARNING TO DO MACROS Arthur L. Carpenter ABSTRACT The macro language can add an additional level of complexity to programs written in SAS~. Macro statements
More informationProgram Validation: Logging the Log
Program Validation: Logging the Log Adel Fahmy, Symbiance Inc., Princeton, NJ ABSTRACT Program Validation includes checking both program Log and Logic. The program Log should be clear of any system Error/Warning
More informationWrite SAS Code to Generate Another SAS Program A Dynamic Way to Get Your Data into SAS
Paper 175-29 Write SAS Code to Generate Another SAS Program A Dynamic Way to Get Your Data into SAS Linda Gau, Pro Unlimited @ Genentech, Inc., South San Francisco, CA ABSTRACT In this paper we introduce
More informationMoving a Large SAS System Into an MVS Production Environment The Trials and Tribulations
Moving a Large SAS System Into an MVS Production Environment The Trials and Tribulations Bernard Gardocki and Stephen Rhoades IMS HEALTH Inc., Plymouth Meeting, Pa ABSTRACT It is not the role, or responsibility
More informationSpeed Dating: Looping Through a Table Using Dates
Paper 1645-2014 Speed Dating: Looping Through a Table Using Dates Scott Fawver, Arch Mortgage Insurance Company, Walnut Creek, CA ABSTRACT Have you ever needed to use dates as values to loop through a
More informationMapping Clinical Data to a Standard Structure: A Table Driven Approach
ABSTRACT Paper AD15 Mapping Clinical Data to a Standard Structure: A Table Driven Approach Nancy Brucken, i3 Statprobe, Ann Arbor, MI Paul Slagle, i3 Statprobe, Ann Arbor, MI Clinical Research Organizations
More informationTop-Down Programming with SAS Macros Edward Heaton, Westat, Rockville, MD
Paper P813 Top-Down Programming with SAS Macros Edward Heaton, Westat, Rockville, MD ABSTRACT Structured, top-down programming techniques are not intuitively obvious in the SAS language, but macros can
More informationSurviving the SAS Macro Jungle by Using Your Own Programming Toolkit Kevin Russell, SAS Institute Inc., Cary, North Carolina
PharmaSUG 2016 Paper BB11 Surviving the SAS Macro Jungle by Using Your Own Programming Toolkit Kevin Russell, SAS Institute Inc., Cary, North Carolina ABSTRACT Almost every night there is a reality show
More informationSAS Macro. SAS Training Courses. Amadeus Software Ltd
SAS Macro SAS Training Courses By Amadeus Software Ltd AMADEUS SOFTWARE LIMITED SAS TRAINING Amadeus have been delivering SAS Training since 1989 and our aim is to provide you with best quality SAS training
More informationSD10 A SAS MACRO FOR PERFORMING BACKWARD SELECTION IN PROC SURVEYREG
Paper SD10 A SAS MACRO FOR PERFORMING BACKWARD SELECTION IN PROC SURVEYREG Qixuan Chen, University of Michigan, Ann Arbor, MI Brenda Gillespie, University of Michigan, Ann Arbor, MI ABSTRACT This paper
More informationAP13 Why Write a Macro? Then Again, Why Not? John W. Davison, Jr., Factotum Inc., Leesburg, VA
AP13 Why Write a Macro? Then Again, Why Not? John W. Davison, Jr., Factotum Inc., Leesburg, VA ABSTRACT One of the most useful SAS tools for designing and programming applications is the SAS macro language.
More informationAn Introduction to SAS Macros
An Introduction to SAS Macros Expanded token SAS Program (Input Stack) SAS Wordscanner (Tokenization) Non-Macro (Tokens) SAS Compiler % and & Triggers Macro Facility Steven First, President 2997 Yarmouth
More informationAdvanced Macro Topics Steven First, Systems Seminar Consultants, Madison, WI
Paper 19-26 Advanced Macro Topics Steven First, Systems Seminar Consultants, Madison, WI Abstract The SAS macro language continues to be an integral part of the SAS system, and can be a wonderful tool
More informationMOBILE MACROS GET UP TO SPEED SOMEWHERE NEW FAST Author: Patricia Hettinger, Data Analyst Consultant Oakbrook Terrace, IL
MOBILE MACROS GET UP TO SPEED SOMEWHERE NEW FAST Author: Patricia Hettinger, Data Analyst Consultant Oakbrook Terrace, IL ABSTRACT: Have you ever been faced with this scenario? It s your first day on the
More information%Addval: A SAS Macro Which Completes the Cartesian Product of Dataset Observations for All Values of a Selected Set of Variables
%Addval: A SAS Macro Which Completes the Cartesian Product of Dataset Observations for All Values of a Selected Set of Variables Rich Schiefelbein, PRA International, Lenexa, KS ABSTRACT It is often useful
More informationCreating Macro Calls using Proc Freq
Creating Macro Calls using Proc Freq, Educational Testing Service, Princeton, NJ ABSTRACT Imagine you were asked to get a series of statistics/tables for each country in the world. You have the data, but
More informationUtilizing the Stored Compiled Macro Facility in a Multi-user Clinical Trial Setting
Paper AD05 Utilizing the Stored Compiled Macro Facility in a Multi-user Clinical Trial Setting Mirjana Stojanovic, Duke University Medical Center, Durham, NC Dorothy Watson, Duke University Medical Center,
More informationTransforming SAS code into a SAS Macro using PERL Sumner H. Williams, CareOregon, Portland, OR, USA
ABSTRACT Transforming SAS code into a SAS Macro using PERL Sumner H. Williams, CareOregon, Portland, OR, USA SAS code is strengthened by transforming the code into a macro. This paper is intended to demonstrate
More informationBasic Macro Processing Prepared by Destiny Corporation
Basic Macro Processing Prepared by Destiny Corporation Macro variables In this module we discuss the first of the two special characters - the ampersand (&). When the SAS Supervisor sees an ampersand followed
More informationPASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year
PASS4TEST \ http://www.pass4test.com We offer free update service for one year Exam : A00-212 Title : SAS Advanced Programming Exam for SAS 9 Vendor : SASInstitute Version : DEMO Get Latest & Valid A00-212
More informationwork.test temp.test sasuser.test test
DSCI 325 Midterm Practice Test Spring 2017 Name: 1. Consider the following four names used to create a SAS data set: work.test temp.test sasuser.test test How many of these will be stored as permanent
More informationABSTRACT INTRODUCTION MACRO. Paper RF
Paper RF-08-2014 Burst Reporting With the Help of PROC SQL Dan Sturgeon, Priority Health, Grand Rapids, Michigan Erica Goodrich, Priority Health, Grand Rapids, Michigan ABSTRACT Many SAS programmers need
More informationABSTRACT DATA CLARIFCIATION FORM TRACKING ORACLE TABLE INTRODUCTION REVIEW QUALITY CHECKS
Efficient SAS Quality Checks: Unique Error Identification And Enhanced Data Management Analysis Jim Grudzinski, Biostatistics Manager Of SAS Programming Covance Periapproval Services Inc, Radnor, PA ABSTRACT
More informationINTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS
TO SAS NEED FOR SAS WHO USES SAS WHAT IS SAS? OVERVIEW OF BASE SAS SOFTWARE DATA MANAGEMENT FACILITY STRUCTURE OF SAS DATASET SAS PROGRAM PROGRAMMING LANGUAGE ELEMENTS OF THE SAS LANGUAGE RULES FOR SAS
More informationTemplate Versatility Using SAS Macro Language to Generate Dynamic RTF Reports Patrick Leon, MPH
Versatility Using SAS Macro Language to Generate Dynamic RTF Reports Versatility Using SAS Macro Language to Generate Dynamic RTF Reports ABSTRACT SAS Macro Language can be used to enhance many report-generating
More informationA SAS Macro to Create Validation Summary of Dataset Report
ABSTRACT PharmaSUG 2018 Paper EP-25 A SAS Macro to Create Validation Summary of Dataset Report Zemin Zeng, Sanofi, Bridgewater, NJ This paper will introduce a short SAS macro developed at work to create
More informationT.I.P.S. (Techniques and Information for Programming in SAS )
Paper PO-088 T.I.P.S. (Techniques and Information for Programming in SAS ) Kathy Harkins, Carolyn Maass, Mary Anne Rutkowski Merck Research Laboratories, Upper Gwynedd, PA ABSTRACT: This paper provides
More informationPROC SQL VS. DATA STEP PROCESSING JEFF SIMPSON SAS CUSTOMER LOYALTY
PROC SQL VS. DATA STEP PROCESSING JEFF SIMPSON SAS CUSTOMER LOYALTY PROC SQL VS. DATA STEP What types of functionality do each provide Types of Joins Replicating joins using the data step How do each work
More informationEfficiency Programming with Macro Variable Arrays
ABSTRACT MWSUG 2018 - Paper SP-062 Efficiency Programming with Macro Variable Arrays Veronica Renauldo, QST Consultations, LTD, Allendale, MI Macros in themselves boost productivity and cut down on user
More informationIntroduction to the SAS Macro Facility
Introduction to the SAS Macro Facility Uses for SAS Macros The macro language allows for programs that are dynamic capable of selfmodification. The major components of the macro language include: Macro
More informationODS DOCUMENT, a practical example. Ruurd Bennink, OCS Consulting B.V., s-hertogenbosch, the Netherlands
Paper CC01 ODS DOCUMENT, a practical example Ruurd Bennink, OCS Consulting B.V., s-hertogenbosch, the Netherlands ABSTRACT The ODS DOCUMENT destination (in short ODS DOCUMENT) is perhaps the most underutilized
More information%MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System
%MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System Rushi Patel, Creative Information Technology, Inc., Arlington, VA ABSTRACT It is common to find
More informationSAS PROGRAMMING AND APPLICATIONS (STAT 5110/6110): FALL 2015 Module 2
SAS PROGRAMMING AND APPLICATIONS (STAT 5110/6110): FALL 2015 Department of MathemaGcs and StaGsGcs Phone: 4-3620 Office: Parker 364- A E- mail: carpedm@auburn.edu Web: hup://www.auburn.edu/~carpedm/stat6110
More informationProve QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC
Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC ABSTRACT Since collecting drug trial data is expensive and affects human life, the FDA and most pharmaceutical company
More informationA Table Driven ODS Macro Diane E. Brown, exponential Systems, Indianapolis, IN
A Table Driven ODS Macro Diane E. Brown, exponential Systems, Indianapolis, IN ABSTRACT Tired of coding ODS statements and SAS output procedures for every report you write and having redundant or similar
More information%MAKE_IT_COUNT: An Example Macro for Dynamic Table Programming Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma
Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma ABSTRACT Today there is more pressure on programmers to deliver summary outputs faster without sacrificing quality. By using just a few programming
More informationValidation Summary using SYSINFO
Validation Summary using SYSINFO Srinivas Vanam Mahipal Vanam Shravani Vanam Percept Pharma Services, Bridgewater, NJ ABSTRACT This paper presents a macro that produces a Validation Summary using SYSINFO
More informationA Plot & a Table per Page Times Hundreds in a Single PDF file
A Plot & a Table per Page Times Hundreds in a Single PDF file Daniel Leprince DIEM Computing Services, Inc. Elizabeth Li DIEM Computing Services, Inc. SAS is a registered trademark or trademark of SAS
More informationAcknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi
Contents Part 1 Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi Macro Basics Chapter 1 Introduction 3 1.1 Macro Facility Overview 3 1.2 Terminology
More informationMacro Method to use Google Maps and SAS to Geocode a Location by Name or Address
Paper 2684-2018 Macro Method to use Google Maps and SAS to Geocode a Location by Name or Address Laurie Smith, Cincinnati Children s Hospital Medical Center, Cincinnati, Ohio ABSTRACT Google Maps is a
More informationDATA Step Debugger APPENDIX 3
1193 APPENDIX 3 DATA Step Debugger Introduction 1194 Definition: What is Debugging? 1194 Definition: The DATA Step Debugger 1194 Basic Usage 1195 How a Debugger Session Works 1195 Using the Windows 1195
More informationCustomising SAS OQ to Provide Business Specific Testing of SAS Installations and Updates
Paper TS07 Customising SAS OQ to Provide Business Specific Testing of SAS Installations and Updates Steve Huggins, Amadeus Software Limited, Oxford, UK ABSTRACT The SAS Installation Qualification and Operational
More informationInnovative Performance Improvements Through Automated Flowcharts In SAS
ABSTRACT Paper 11580-2016 Innovative Performance Improvements Through Automated Flowcharts In SAS Steven First, Systems Seminar Consultants, Inc. One of the tedious but necessary things that SAS programmers
More informationArthur L. Carpenter California Occidental Consultants, Oceanside, California
Paper 028-30 Storing and Using a List of Values in a Macro Variable Arthur L. Carpenter California Occidental Consultants, Oceanside, California ABSTRACT When using the macro language it is not at all
More informationChristopher Louden University of Texas Health Science Center at San Antonio
Christopher Louden University of Texas Health Science Center at San Antonio Overview of Macro Language Report Writing The REPORT procedure The Output Delivery System (ODS) Macro Examples Utility Macros
More informationContents. About This Book...1
Contents About This Book...1 Chapter 1: Basic Concepts...5 Overview...6 SAS Programs...7 SAS Libraries...13 Referencing SAS Files...15 SAS Data Sets...18 Variable Attributes...21 Summary...26 Practice...28
More informationSAS Macros for Grouping Count and Its Application to Enhance Your Reports
SAS Macros for Grouping Count and Its Application to Enhance Your Reports Shi-Tao Yeh, EDP Contract Services, Bala Cynwyd, PA ABSTRACT This paper provides two SAS macros, one for one grouping variable,
More informationTLF Management Tools: SAS programs to help in managing large number of TLFs. Eduard Joseph Siquioco, PPD, Manila, Philippines
PharmaSUG China 2018 Paper AD-58 TLF Management Tools: SAS programs to help in managing large number of TLFs ABSTRACT Eduard Joseph Siquioco, PPD, Manila, Philippines Managing countless Tables, Listings,
More informationUsing PROC REPORT to Cross-Tabulate Multiple Response Items Patrick Thornton, SRI International, Menlo Park, CA
Using PROC REPORT to Cross-Tabulate Multiple Response Items Patrick Thornton, SRI International, Menlo Park, CA ABSTRACT This paper describes for an intermediate SAS user the use of PROC REPORT to create
More informationAutomated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ
PharmaSUG 2015 - Paper QT41 Automated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ ABSTRACT Most often clinical trial data analysis has tight deadlines with very
More informationUsing GSUBMIT command to customize the interface in SAS Xin Wang, Fountain Medical Technology Co., ltd, Nanjing, China
PharmaSUG China 2015 - Paper PO71 Using GSUBMIT command to customize the interface in SAS Xin Wang, Fountain Medical Technology Co., ltd, Nanjing, China One of the reasons that SAS is widely used as the
More informationCONQUERING THE DREADED MACRO ERROR
CONQUERING THE DREADED MACRO ERROR by Katie A. Hubbell Computer Data Systems, Inc. ABSTRACT The Macro facility is a very powerful tool in SAS* programming. It can, by the same token, cause some rather
More informationGet Started Writing SAS Macros Luisa Hartman, Jane Liao, Merck Sharp & Dohme Corp.
Get Started Writing SAS Macros Luisa Hartman, Jane Liao, Merck Sharp & Dohme Corp. ABSTRACT The SAS Macro Facility is a tool which lends flexibility to your SAS code and promotes easier maintenance. It
More information/ * %STR(argument) %NRSTR(argument)
Macro Quoting Functions Jerry Mock SAS nstitute nc. Quoting Functions Available in the SAS Macro Language Compile time functions %STR(argument) 6NRSTR (argument) Execution time functions %QUOTE (argument)
More informationSAS Macro Programming for Beginners
ABSTRACT SAS Macro Programming for Beginners Lora D. Delwiche, Winters, CA Susan J. Slaughter, Avocet Solutions, Davis, CA Macro programming is generally considered an advanced topic. But, while macros
More informationSAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority
SAS 101 Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23 By Tasha Chapman, Oregon Health Authority Topics covered All the leftovers! Infile options Missover LRECL=/Pad/Truncover
More informationTips & Tricks. With lots of help from other SUG and SUGI presenters. SAS HUG Meeting, November 18, 2010
Tips & Tricks With lots of help from other SUG and SUGI presenters 1 SAS HUG Meeting, November 18, 2010 2 3 Sorting Threads Multi-threading available if your computer has more than one processor (CPU)
More informationMore About SAS Macros
More About SAS Macros (Than You Thought Possible) Donald P. Gallogly DCBS IMD Topics The SAS Macros System Macro Variables Writing Macros The SAS Macros System The SAS Macros System SAS macros and macro
More informationDictionary.coumns is your friend while appending or moving data
ABSTRACT SESUG Paper CC-41-2017 Dictionary.coumns is your friend while appending or moving data Kiran Venna, Dataspace Inc. Dictionary.columns is a dictionary table, which gives metadata information of
More informationJob Security: Using the SAS Macro Language to Full Advantage
Job Security: Using the SAS Macro Language to Full Advantage Arthur L. Carpenter California Occidental Consultants, Oceanside, California ABSTRACT As has been discussed in other papers on the topic of
More information