Writing cleaner and more powerful SAS code using macros. Patrick Breheny
|
|
|
- Megan McDaniel
- 10 years ago
- Views:
Transcription
1 Writing cleaner and more powerful SAS code using macros Patrick Breheny
2 Why Use Macros? Macros automatically generate SAS code Macros allow you to make more dynamic, complex, and generalizable SAS programs Macros can greatly reduce the effort required to read and write SAS Code
3 Outline 1. Macro Basics 2. Working with Macro Strings 3. Getting More Out of Macros: a) Program Control b) Interfacing with Data
4 The Compilation of SAS Programs SAS code is compiled and executed alternately in steps: For example, a data step will be compiled and executed, then a procedure step will be compiled and executed IMPORTANT: Macros are resolved PRIOR to the compilation and execution of the SAS code
5 SAS Compilation (cont d) Code without Macros: SAS Code Compilation Program Execution Results Code with Macros: SAS Code with Macros Macro Processing SAS Code without Macros Compilation Execution Results
6 Macro Basics The two basic elements of macro code are macro variables and macros. In SAS code: &name refers to a macro variable %name refers to a macro Macro code consists of these two elements and their relationship to each other
7 Macro Variables Macro variables hold the value of text strings The easiest way to assign a value to a macro variable is using %let: Note that: %let mac_var = Hello!!; %put The value of mac_var is &mac_var; The value of mac_var is Hello!! The value of a macro variable is referenced using & Text without % s or & s (called constant text) is unaffected by macro processing Many SAS data step functions (like put) have macro analogs
8 A More Realistic Example Suppose we have separate data sets for each state, and wish to obtain county-level data for a given state without rewriting our code: SAS Code SAS Code after macro processing (invisible) %let state = IA; proc sort data=survey_&state out=sorted_&state; by county; proc means data=sorted_&state; title "&state Results"; by county; proc sort data=survey_ia out=sorted_ia; by county; proc means data=sorted_ia; title IA Results"; by county;
9 Example with Multiple Variables The advantages of this approach are even more prominent when many parameters are present: %let state = IA; %let sortvar = Age; %let order = ; *Note that macro variables can be empty; proc sort data=survey_&state out=county_&state; by county; proc means data=county_&state noprint; by county; output out=county_totals_&state mean=; proc sort data=county_totals_&state out=sorted_&state; by &order &sortvar; proc print data=sorted_&state; title "&state Results by &sortvar";
10 Macros To generate more complicated SAS code, we must use macros, which are assigned using %macro and %mend statements: %macro reg; proc reg data=dataset; model outcome = age sex; %mend reg; A macro that has been assigned can then be referenced with %name. The above regression procedure would be run with: %reg;
11 Macro Parameters The ability to pass parameters to macros make them much more useful. For example, in regression, we often vary the set of predictor variables without changing the rest of the code: %macro reg(predictors); proc reg data=dataset; model outcome = &predictors; %mend reg; %reg(age); %reg(sex); %reg(age sex);
12 Positional vs. Keyword Parameters One can specify macro parameters in two ways. Each approach has its advantages. Positional %macro reg(predictors); proc reg data=dataset; model outcome = &predictors; %mend reg; %reg(age sex); Keyword %macro reg(predictors = age sex); proc reg data=dataset; model outcome = &predictors; %mend reg; %reg; %reg(predictors=age); Note that with keyword parameters, default settings can be assigned
13 Passing Multiple Parameters Usually, a combination of positional and keyword parameters makes the most sense (positional parameters must come before keyword parameters): %macro county_sort(sortvar, state=ia, order=); proc sort data=survey_&state out=county_&state; by county; proc means data=county_&state noprint; by county; output out=county_totals_&state mean=; proc sort data=county_totals_&state out=sorted_&state; by &order &sortvar; proc print data=sorted_&state; title "&state Results by &sortvar"; %mend county_sort; %county_sort(age) %county_sort(mortality, state=fl, order=descending)
14 Working with Macro Strings
15 The Implicit Handling of Strings Because macros and macro variables can only be assigned strings of text, string functions on macro variables are handled implicitly: Assignment: No quotes are necessary around the value of a macro variable (%let mac_var = Hello;) Concatenation: survey_&state concatenates &state with survey_ Most of the time, this is very convenient, but any time you avoid giving explicit instructions, computers may do something other than what you want!
16 Concatenation The expression survey_&state is unambiguous, but what about &state_survey? %put survey_&state; survey_ia %put &state_survey; WARNING: Apparent symbolic reference STATE_SURVEY not resolved. &state_survey A period is the signal in SAS to end a macro variable name: %put &state._survey; IA_survey
17 Concatenation (cont d) Suppose we wished to import data from a file called survey_ia.xls proc import datafile="h:\data\survey_&state.xls" out=survey_&state replace; doesn t work, but proc import datafile="h:\data\survey_&state..xls" out=survey_&state replace; does
18 Double vs. Single Quotes Double quotes and single quotes affect macro variables differently: proc import datafile= H:\Macro Workshop\survey_&state..xls out=survey_&state replace; ERROR: Unable to import, file H:\Macro Workshop\survey_&state..xls does not exist. Note that macro variables inside single quotes are not resolved
19 SAS Characters with Special Meaning Suppose we wish to assign a macro variable a string with semicolons, commas, or quotes The macro function %str can be used, for example, to pass an entire statement into a macro: %macro reg(predictors, options); proc reg data=dataset; model outcome = &predictors; &options %mend reg; %reg(age sex, %str(mtest age, age - sex / canprint;));
20 Evaluating Numeric Strings Remember, macro variables are strings, not numeric quantities: %let sum = 1+1; %put 1+1 The function %eval can be used to obtain the (integer) numeric value of an expression containing macro variables: %let total = %eval(&sum); %put &total; 2 Note: Floating point evaluations can be performed with %sysevalf
21 Getting More Out of Macros
22 Program Control The most powerful feature of macros is their ability to use conditional and iterative statements Data steps provide these same statements, but their effect is limited to a single data step Program control through macros can extend across multiple data steps and procedures
23 Conditional Statements Conditional statements in macros work just like those in data steps %if (&state eq IA) %then %put Iowa; %else %put Not Iowa;
24 %do Blocks Just as in data steps, compound statements are grouped using %do and %end: %if (&state eq IA) %then %do; %put Iowa; %put Corn grows here; %end; %else %put Not Iowa;
25 Iterative Statements Iterative macro statements will also be familiar to anyone who has used the data step versions: %do i = 1 %to 10; %put %eval(&i**2); %end; Note: %do %while and %do %until statements are also available
26 Macro Program Control Statements Macro program control statements are not valid in open code They must be contained within macros
27 Macro Arrays Suppose we created a list of states: %let state1 = AL; %let state2 = AK;... %let state50 = WY; If we were in the i th iteration of a loop, how would we access the i th member of the list? %put &state&i; IA2
28 Macro Arrays (cont d) Instead, we must force the macro processor to make multiple passes over our code: &&state&i 1 st Pass &state2 2 nd Pass AK
29 Example Suppose we wish to create a report by state of county rankings for a number of categories: %macro report; %do i = 1 %to 50; %do j = 1 %to 25; %county_sort(&&var&j, state=&&state&i, order=descending); %end; %end; %mend report; %report;
30 Nesting Macro Calls As we just saw, it is often a good idea to nest macro calls: %macro a; SAS code %b; SAS code %mend a; It is not a good idea to nest macro definitions: %macro a; SAS code %macro b; SAS code %mend b; SAS code %mend a;
31 Nesting Macro Calls (cont d) When nesting macro calls, be careful to avoid variable collisions: %macro print_sums; %do i = 1 %to 10; %put %sum(&i); %end; %mend; %macro sum(n); %let current_sum=0; %do i = 1 %to %eval(&n); %let current_sum=¤t_sum +&i; %end; %eval(¤t_sum) %mend; Scoping issues can be avoided by using %local to define macro variables
32 Interfacing With Data Suppose we submitted the following code to SAS: What would happen? data newdata; set survey_ia; %let AgeSq = Age**2;
33 Interfacing With Data (cont d) Answer: %put &AgeSq; Age**2 Because macros are resolved prior to the execution of a data step, special routines are required for macros to communicate with data: symput puts data into a macro symget extracts data from a macro
34 How symput Works Calling the symput routine pauses execution of the data step and writes a data value to a macro variable Syntax: CALL SYMPUT( macro-variable, data-variable); Both arguments to symput can be expressions IMPORTANT: You CANNOT access a macro variable within the same data step it is created
35 symputx: A Better symput CALL SYMPUTX is a variant of SYMPUT introduced in SAS 9 that has similar syntax, but handles the input of numeric values better The following example illustrates the difference between the two commands: data _null_; call symput('symput',5); call symputx('symputx',5); %put &symput ; %put &symputx ; 5 5
36 Example Suppose we want to compare two groups, but the preferred method depends on sample size: %macro compare(dsn, class, cutoff=20); data _null_; set &dsn nobs=nobs; call symputx('nobs',nobs); stop; %if (&nobs < &cutoff) %then %do; proc npar1way data=&dsn; class &class; %end; %else %do; proc ttest data=&dsn; class &class; %end; %mend compare; %compare(mydata,age);
37 How symget works symget is much more straightforward: data-variable = symget( macro-variable )
38 Putting it all Together As a final example, suppose we want to create a list of indicator variables for the values of a categorical variable in a data set Note that if we don t know the values in advance, we have to approach the problem in two steps 1. Determine the new variables we are to create 2. Create a data set in which we assign values to the new variables
39 Putting it all Together (cont d) We could approach the problem as follows: %macro make_ind(dsn,cat); proc sort data=&dsn out=sorted; by &cat; data _null_; set sorted end=eof; by &cat; if first.&cat then do; tot+1; call symputx("&cat.ind" compress(tot),compress(&cat)); end; if eof then call symputx('tot',tot); (cont d)
40 Putting it all Together (cont d) (cont d) data &dsn._ind; set &dsn; %do i=1 %to %eval(&tot); if (compress(&cat) eq "&&&cat.ind&i") then &&&cat.ind&i = 1; else &&&cat.ind&i = 0; %end; %mend make_ind;
41 Putting it all Together (cont d) %make_ind(survey_ia,city); proc print data=survey_ia_ind; Cedar New Obs County City SBP Age Ames Rapids Albin 1 Story Ames Linn Cedar Rapids Allamakee New Albin Story Ames
42 References The SAS Macro Language Reference: index_912.html Carpenter, Art Carpenter s Complete Guide to the SAS Macro Language, Second Edition. Cary, NC: SAS Institute Inc.
More Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board
More Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board INTRODUCTION In 20 years as a SAS consultant at the Federal Reserve Board, I have seen SAS users make
AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health
AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health INTRODUCTION There are a number of SAS tools that you may never have to use. Why? The main reason
The SAS Data step/macro Interface
Paper TS09 The SAS Data step/macro Interface Lawrence Heaton-Wright, Quintiles, Bracknell, Berkshire, UK ABSTRACT The SAS macro facility is an extremely useful part of the SAS System. However, macro variables
The Power of CALL SYMPUT DATA Step Interface by Examples Yunchao (Susan) Tian, Social & Scientific Systems, Inc., Silver Spring, MD
Paper 052-29 The Power of CALL SYMPUT DATA Step Interface by Examples Yunchao (Susan) Tian, Social & Scientific Systems, Inc., Silver Spring, MD ABSTRACT AND INTRODUCTION CALL SYMPUT is a SAS language
Macros from Beginning to Mend A Simple and Practical Approach to the SAS Macro Facility
Macros from Beginning to Mend A Simple and Practical Approach to the SAS Macro Facility Michael G. Sadof, MGS Associates, Inc., Bethesda, MD. ABSTRACT The macro facility is an important feature of the
The SET Statement and Beyond: Uses and Abuses of the SET Statement. S. David Riba, JADE Tech, Inc., Clearwater, FL
The SET Statement and Beyond: Uses and Abuses of the SET Statement S. David Riba, JADE Tech, Inc., Clearwater, FL ABSTRACT The SET statement is one of the most frequently used statements in the SAS System.
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
Storing and Using a List of Values in a Macro Variable
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 unusual to need
Nine Steps to Get Started using SAS Macros
Paper 56-28 Nine Steps to Get Started using SAS Macros Jane Stroupe, SAS Institute, Chicago, IL ABSTRACT Have you ever heard your coworkers rave about macros? If so, you've probably wondered what all the
SAS Comments How Straightforward Are They? Jacksen Lou, Merck & Co.,, Blue Bell, PA 19422
SAS Comments How Straightforward Are They? Jacksen Lou, Merck & Co.,, Blue Bell, PA 19422 ABSTRACT SAS comment statements typically use conventional symbols, *, %*, /* */. Most programmers regard SAS commenting
Data Presentation. Paper 126-27. Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs
Paper 126-27 Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs Tugluke Abdurazak Abt Associates Inc. 1110 Vermont Avenue N.W. Suite 610 Washington D.C. 20005-3522
Tales from the Help Desk 3: More Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board
Tales from the Help Desk 3: More Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board INTRODUCTION In 20 years as a SAS consultant at the Federal Reserve Board, I have seen SAS users make
PharmaSUG 2014 Paper CC23. Need to Review or Deliver Outputs on a Rolling Basis? Just Apply the Filter! Tom Santopoli, Accenture, Berwyn, PA
PharmaSUG 2014 Paper CC23 Need to Review or Deliver Outputs on a Rolling Basis? Just Apply the Filter! Tom Santopoli, Accenture, Berwyn, PA ABSTRACT Wouldn t it be nice if all of the outputs in a deliverable
Search and Replace in SAS Data Sets thru GUI
Search and Replace in SAS Data Sets thru GUI Edmond Cheng, Bureau of Labor Statistics, Washington, DC ABSTRACT In managing data with SAS /BASE software, performing a search and replace is not a straight
We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.
LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.
Using Macros to Automate SAS Processing Kari Richardson, SAS Institute, Cary, NC Eric Rossland, SAS Institute, Dallas, TX
Paper 126-29 Using Macros to Automate SAS Processing Kari Richardson, SAS Institute, Cary, NC Eric Rossland, SAS Institute, Dallas, TX ABSTRACT This hands-on workshop shows how to use the SAS Macro Facility
SAS Macro Programming for Beginners
Paper 243-29 SAS Macro Programming for Beginners Susan J. Slaughter, Avocet Solutions, Davis, CA Lora D. Delwiche, Delwiche Consulting, Winters, CA ABSTRACT Macro programming is generally considered an
Oracle SQL. Course Summary. Duration. Objectives
Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data
Managing Tables in Microsoft SQL Server using SAS
Managing Tables in Microsoft SQL Server using SAS Jason Chen, Kaiser Permanente, San Diego, CA Jon Javines, Kaiser Permanente, San Diego, CA Alan L Schepps, M.S., Kaiser Permanente, San Diego, CA Yuexin
Debugging Complex Macros
Debugging Complex Macros Peter Stagg, Decision Informatics It s possible to write code generated by macros to an external file. The file can t be access until the SAS session has ended. Use the options
You have got SASMAIL!
You have got SASMAIL! Rajbir Chadha, Cognizant Technology Solutions, Wilmington, DE ABSTRACT As SAS software programs become complex, processing times increase. Sitting in front of the computer, waiting
First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science
First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca
Oracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction
Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June 2014. Dr.-Ing.
Computers An Introduction to Programming with Python CCHSG Visit June 2014 Dr.-Ing. Norbert Völker Many computing devices are embedded Can you think of computers/ computing devices you may have in your
Creating External Files Using SAS Software
Creating External Files Using SAS Software Clinton S. Rickards Oxford Health Plans, Norwalk, CT ABSTRACT This paper will review the techniques for creating external files for use with other software. This
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction
Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois
Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois Abstract This paper introduces SAS users with at least a basic understanding of SAS data
From The Little SAS Book, Fifth Edition. Full book available for purchase here.
From The Little SAS Book, Fifth Edition. Full book available for purchase here. Acknowledgments ix Introducing SAS Software About This Book xi What s New xiv x Chapter 1 Getting Started Using SAS Software
Exercise 1: Python Language Basics
Exercise 1: Python Language Basics In this exercise we will cover the basic principles of the Python language. All languages have a standard set of functionality including the ability to comment code,
Chapter 2: Elements of Java
Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction
Using SAS With a SQL Server Database. M. Rita Thissen, Yan Chen Tang, Elizabeth Heath RTI International, RTP, NC
Using SAS With a SQL Server Database M. Rita Thissen, Yan Chen Tang, Elizabeth Heath RTI International, RTP, NC ABSTRACT Many operations now store data in relational databases. You may want to use SAS
VHDL Test Bench Tutorial
University of Pennsylvania Department of Electrical and Systems Engineering ESE171 - Digital Design Laboratory VHDL Test Bench Tutorial Purpose The goal of this tutorial is to demonstrate how to automate
Oracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the
Advanced Bash Scripting. Joshua Malone ([email protected])
Advanced Bash Scripting Joshua Malone ([email protected]) Why script in bash? You re probably already using it Great at managing external programs Powerful scripting language Portable and version-stable
Beginning Tutorials. bt009 A TUTORIAL ON THE SAS MACRO LANGUAGE John J. Cohen AstraZeneca LP
bt009 A TUTORIAL ON THE SAS MACRO LANGUAGE John J. Cohen AstraZeneca LP Abstract The SAS Macro language is another language that rests on top of regular SAS code. If used properly, it can make programming
Retrieving Data from Large DB2 Tables Based on Keys in SAS : The Sequel
Introduction and Overview Over the last few years, a number of papers have been presented at SUGI and regional conferences discussing the problem of how to extract data from one or more DB2 tables when
How to Reduce the Disk Space Required by a SAS Data Set
How to Reduce the Disk Space Required by a SAS Data Set Selvaratnam Sridharma, U.S. Census Bureau, Washington, DC ABSTRACT SAS datasets can be large and disk space can often be at a premium. In this paper,
Effective Use of SQL in SAS Programming
INTRODUCTION Effective Use of SQL in SAS Programming Yi Zhao Merck & Co. Inc., Upper Gwynedd, Pennsylvania Structured Query Language (SQL) is a data manipulation tool of which many SAS programmers are
Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
Beyond the Basics: Advanced REPORT Procedure Tips and Tricks Updated for SAS 9.2 Allison McMahill Booth, SAS Institute Inc.
ABSTRACT PharmaSUG 2011 - Paper SAS-AD02 Beyond the Basics: Advanced REPORT Procedure Tips and Tricks Updated for SAS 9.2 Allison McMahill Booth, SAS Institute Inc., Cary, NC, USA This paper is an update
Eliminating Tedium by Building Applications that Use SQL Generated SAS Code Segments
Eliminating Tedium by Building Applications that Use SQL Generated SAS Code Segments David A. Mabey, Reader s Digest Association Inc., Pleasantville, NY ABSTRACT When SAS applications are driven by data-generated
Introduction to Python
Caltech/LEAD Summer 2012 Computer Science Lecture 2: July 10, 2012 Introduction to Python The Python shell Outline Python as a calculator Arithmetic expressions Operator precedence Variables and assignment
Applications Development ABSTRACT PROGRAM DESIGN INTRODUCTION SAS FEATURES USED
Checking and Tracking SAS Programs Using SAS Software Keith M. Gregg, Ph.D., SCIREX Corporation, Chicago, IL Yefim Gershteyn, Ph.D., SCIREX Corporation, Chicago, IL ABSTRACT Various checks on consistency
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
Using the Magical Keyword "INTO:" in PROC SQL
Using the Magical Keyword "INTO:" in PROC SQL Thiru Satchi Blue Cross and Blue Shield of Massachusetts, Boston, Massachusetts Abstract INTO: host-variable in PROC SQL is a powerful tool. It simplifies
An Incomplete C++ Primer. University of Wyoming MA 5310
An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages
Macro Quoting. Overview of Macro Quoting CHAPTER 7
71 CHAPTER 7 Macro Quoting Overview of Macro Quoting 71 Understanding Why Macro Quoting is Necessary 72 Understanding Macro Quoting Functions 72 Passing Parameters That Contain Special Characters and Mnemonics
The presentation will include a code review and presentation of reports that appear in both English and Italian.
SAS Reporting in English, ed anche in italiano: A Methodology for Creating Reports in Two Languages Deborah Testa, Seven of Nine Systems, Inc. Studio City, CA ABSTRACT Project Leonardo was a disease management
MATCH-MERGING: 20 Some Traps and How to Avoid Them. Malachy J. Foley. University of North Carolina at Chapel Hill, NC ABSTRACT
MATCH-MERGING: 20 Some Traps and How to Avoid Them Malachy J. Foley University of North Carolina at Chapel Hill, NC ABSTRACT Match-merging is a common form of combining files. Yet, it has its pitfalls.
Labels, Labels, and More Labels Stephanie R. Thompson, Rochester Institute of Technology, Rochester, NY
Paper FF-007 Labels, Labels, and More Labels Stephanie R. Thompson, Rochester Institute of Technology, Rochester, NY ABSTRACT SAS datasets include labels as optional variable attributes in the descriptor
ESPResSo Summer School 2012
ESPResSo Summer School 2012 Introduction to Tcl Pedro A. Sánchez Institute for Computational Physics Allmandring 3 D-70569 Stuttgart Germany http://www.icp.uni-stuttgart.de 2/26 Outline History, Characteristics,
Quick Start to Data Analysis with SAS Table of Contents. Chapter 1 Introduction 1. Chapter 2 SAS Programming Concepts 7
Chapter 1 Introduction 1 SAS: The Complete Research Tool 1 Objectives 2 A Note About Syntax and Examples 2 Syntax 2 Examples 3 Organization 4 Chapter by Chapter 4 What This Book Is Not 5 Chapter 2 SAS
CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013
Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)
Data Cleaning 101. Ronald Cody, Ed.D., Robert Wood Johnson Medical School, Piscataway, NJ. Variable Name. Valid Values. Type
Data Cleaning 101 Ronald Cody, Ed.D., Robert Wood Johnson Medical School, Piscataway, NJ INTRODUCTION One of the first and most important steps in any data processing task is to verify that your data values
Parallel Data Preparation with the DS2 Programming Language
ABSTRACT Paper SAS329-2014 Parallel Data Preparation with the DS2 Programming Language Jason Secosky and Robert Ray, SAS Institute Inc., Cary, NC and Greg Otto, Teradata Corporation, Dayton, OH A time-consuming
Oracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to
PHP Debugging. Draft: March 19, 2013 2013 Christopher Vickery
PHP Debugging Draft: March 19, 2013 2013 Christopher Vickery Introduction Debugging is the art of locating errors in your code. There are three types of errors to deal with: 1. Syntax errors: When code
Programming Idioms Using the SET Statement
Programming Idioms Using the SET Statement Jack E. Fuller, Trilogy Consulting Corporation, Kalamazoo, MI ABSTRACT While virtually every programmer of base SAS uses the SET statement, surprisingly few programmers
An Introduction to SAS/SHARE, By Example
Paper 020-29 An Introduction to SAS/SHARE, By Example Larry Altmayer, U.S. Census Bureau, Washington, DC ABSTRACT SAS/SHARE software is a useful tool for allowing several users to simultaneously access
Advanced Tutorials. Numeric Data In SAS : Guidelines for Storage and Display Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD
Numeric Data In SAS : Guidelines for Storage and Display Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD ABSTRACT Understanding how SAS stores and displays numeric data is essential
QUIZ-II QUIZ-II. Chapter 5: Control Structures II (Repetition) Objectives. Objectives (cont d.) 20/11/2015. EEE 117 Computer Programming Fall-2015 1
QUIZ-II Write a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. (For
University of Hull Department of Computer Science. Wrestling with Python Week 01 Playing with Python
Introduction Welcome to our Python sessions. University of Hull Department of Computer Science Wrestling with Python Week 01 Playing with Python Vsn. 1.0 Rob Miles 2013 Please follow the instructions carefully.
Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
Five Ways to Create Macro Variables: A Short Introduction to the Macro Language
Paper HW03_05 Five Ways to Create Macro Variables: A Short Introduction to the Macro Language Arthur L. Carpenter California Occidental Consultants, Oceanside, California ABSTRACT The macro language is
Automating SAS Macros: Run SAS Code when the Data is Available and a Target Date Reached.
Automating SAS Macros: Run SAS Code when the Data is Available and a Target Date Reached. Nitin Gupta, Tailwind Associates, Schenectady, NY ABSTRACT This paper describes a method to run discreet macro(s)
Introduction to Python
WEEK ONE Introduction to Python Python is such a simple language to learn that we can throw away the manual and start with an example. Traditionally, the first program to write in any programming language
Oracle Database 12c: Introduction to SQL Ed 1.1
Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,
AN INTRODUCTION TO THE SQL PROCEDURE Chris Yindra, C. Y. Associates
AN INTRODUCTION TO THE SQL PROCEDURE Chris Yindra, C Y Associates Abstract This tutorial will introduce the SQL (Structured Query Language) procedure through a series of simple examples We will initially
Using Pharmacovigilance Reporting System to Generate Ad-hoc Reports
Using Pharmacovigilance Reporting System to Generate Ad-hoc Reports Jeff Cai, Amylin Pharmaceuticals, Inc., San Diego, CA Jay Zhou, Amylin Pharmaceuticals, Inc., San Diego, CA ABSTRACT To supplement Oracle
Symbol Tables. Introduction
Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The
CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases
3 CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases About This Document 3 Methods for Accessing Relational Database Data 4 Selecting a SAS/ACCESS Method 4 Methods for Accessing DBMS Tables
6.170 Tutorial 3 - Ruby Basics
6.170 Tutorial 3 - Ruby Basics Prerequisites 1. Have Ruby installed on your computer a. If you use Mac/Linux, Ruby should already be preinstalled on your machine. b. If you have a Windows Machine, you
A Brief Introduction to MySQL
A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term
B) Mean Function: This function returns the arithmetic mean (average) and ignores the missing value. E.G: Var=MEAN (var1, var2, var3 varn);
SAS-INTERVIEW QUESTIONS 1. What SAS statements would you code to read an external raw data file to a DATA step? Ans: Infile and Input statements are used to read external raw data file to a Data Step.
How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)
TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions
Developing an On-Demand Web Report Platform Using Stored Processes and SAS Web Application Server
Paper 10740-2016 Developing an On-Demand Web Report Platform Using Stored Processes and SAS Web Application Server ABSTRACT Romain Miralles, Genomic Health. As SAS programmers, we often develop listings,
Automation of Large SAS Processes with Email and Text Message Notification Seva Kumar, JPMorgan Chase, Seattle, WA
Automation of Large SAS Processes with Email and Text Message Notification Seva Kumar, JPMorgan Chase, Seattle, WA ABSTRACT SAS includes powerful features in the Linux SAS server environment. While creating
Lecture 5: Java Fundamentals III
Lecture 5: Java Fundamentals III School of Science and Technology The University of New England Trimester 2 2015 Lecture 5: Java Fundamentals III - Operators Reading: Finish reading Chapter 2 of the 2nd
Computer Programming I
Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,
SAS ODS HTML + PROC Report = Fantastic Output Girish K. Narayandas, OptumInsight, Eden Prairie, MN
SA118-2014 SAS ODS HTML + PROC Report = Fantastic Output Girish K. Narayandas, OptumInsight, Eden Prairie, MN ABSTRACT ODS (Output Delivery System) is a wonderful feature in SAS to create consistent, presentable
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
AN ANIMATED GUIDE: SENDING SAS FILE TO EXCEL
Paper CC01 AN ANIMATED GUIDE: SENDING SAS FILE TO EXCEL Russ Lavery, Contractor for K&L Consulting Services, King of Prussia, U.S.A. ABSTRACT The primary purpose of this paper is to provide a generic DDE
Introduction to Matlab
Introduction to Matlab Social Science Research Lab American University, Washington, D.C. Web. www.american.edu/provost/ctrl/pclabs.cfm Tel. x3862 Email. [email protected] Course Objective This course provides
Hands-on Exercise 1: VBA Coding Basics
Hands-on Exercise 1: VBA Coding Basics This exercise introduces the basics of coding in Access VBA. The concepts you will practise in this exercise are essential for successfully completing subsequent
BASH Scripting. A bash script may consist of nothing but a series of command lines, e.g. The following helloworld.sh script simply does an echo.
BASH Scripting bash is great for simple scripts that automate things you would otherwise by typing on the command line. Your command line skills will carry over to bash scripting and vice versa. bash comments
PO-18 Array, Hurray, Array; Consolidate or Expand Your Input Data Stream Using Arrays
Array, Hurray, Array; Consolidate or Expand Your Input Data Stream Using Arrays, continued SESUG 2012 PO-18 Array, Hurray, Array; Consolidate or Expand Your Input Data Stream Using Arrays William E Benjamin
Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff
D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led
Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, 2008. 1 Introduction 1. 2 Invoking Shell Scripts 2
Unix Shell Scripts Norman Matloff July 30, 2008 Contents 1 Introduction 1 2 Invoking Shell Scripts 2 2.1 Direct Interpretation....................................... 2 2.2 Indirect Interpretation......................................
Salary. Cumulative Frequency
HW01 Answering the Right Question with the Right PROC Carrie Mariner, Afton-Royal Training & Consulting, Richmond, VA ABSTRACT When your boss comes to you and says "I need this report by tomorrow!" do
Table Lookups: From IF-THEN to Key-Indexing
Paper 158-26 Table Lookups: From IF-THEN to Key-Indexing Arthur L. Carpenter, California Occidental Consultants ABSTRACT One of the more commonly needed operations within SAS programming is to determine
Data-driven Validation Rules: Custom Data Validation Without Custom Programming Don Hopkins, Ursa Logic Corporation, Durham, NC
Data-driven Validation Rules: Custom Data Validation Without Custom Programming Don Hopkins, Ursa Logic Corporation, Durham, NC ABSTRACT One of the most expensive and time-consuming aspects of data management
Informatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
Modifying Insurance Rating Territories Via Clustering
Modifying Insurance Rating Territories Via Clustering Quncai Zou, New Jersey Manufacturers Insurance Company, West Trenton, NJ Ryan Diehl, New Jersey Manufacturers Insurance Company, West Trenton, NJ ABSTRACT
csce4313 Programming Languages Scanner (pass/fail)
csce4313 Programming Languages Scanner (pass/fail) John C. Lusth Revision Date: January 18, 2005 This is your first pass/fail assignment. You may develop your code using any procedural language, but you
Problem 1. CS 61b Summer 2005 Homework #2 Due July 5th at the beginning of class
CS 61b Summer 2005 Homework #2 Due July 5th at the beginning of class This homework is to be done individually. You may, of course, ask your fellow classmates for help if you have trouble editing files,
