The Basics of PROC FCMP. Dachao Liu Northwestern Universtiy Chicago

Size: px
Start display at page:

Download "The Basics of PROC FCMP. Dachao Liu Northwestern Universtiy Chicago"

Transcription

1 The Basics of PROC FCMP Dachao Liu Northwestern Universtiy Chicago ABSTRACT SAS Functions can save SAS users time and effort in programming. Each release of SAS has new functions added. Up to the latest version of SAS 9.3, there are over 450 functions. Even with a vast plethora of SAS functions, some SAS users still find the lack of some functions to perform certain tasks. Fortunately, In SAS 9, a new procedure called PROC FCMP was developed to help SAS users to write their own functions. This paper will discuss the basics of PROC FCMP and how we can use it to build our own SAS functions. The intended audience would be those who have a basic idea of SAS functions. INTRODUCTION Like many other programming languages, SAS has a vast number of built-in functions. A SAS function is a method to perform a task like computation or data manipulation and return a value based on the arguments given. SAS is very rich in built-in functions, saving SAS users tons of time and programming effort. In SAS version 6, there were only 236 functions, In SAS 9, there are almost twice as many. But oftentimes, we still find there is not enough. How can we do this special computation? How can we remove that extra character? How can we use MS Excel functions in SAS? The questions can go on and on. To meet SAS users needs, SAS institute developed a new procedure, PROC FCMP. By using PROC FCMP, we can find answers to those questions. In this paper, I will discuss what is PROC FCMP, and then some examples. DISCUSSION What is a function? In our daily life, by saying something is functioning, we mean something is doing task by rule. The heart is functioning when it plumps blood through the body. In academic field, we also use function to mean performing some tasks by rule, thus creating lots of functions in math and computer languages. They are like machines because they need an input to create an output. So the output is related somehow to the input. Y=9*x is a function. If the input is 8 for x, then the output is 72 for y, and we may write f(8) = 72. The input variable(s) are sometimes referred to as the argument(s) of the function. Like a math function, a SAS function also needs an input in order to create an output. A SAS function is a method to perform a task like computation or data manipulation and return a value based on the arguments given. SAS functions are often categorized by the type of data to be processed and type of task a function performs. SAS data sets can be classified as numeric and character, therefore SAS functions are often categorized into function handling numeric data (numeric functions) and function handling character data (character functions) and some special functions. Special functions perform special tasks like converting data from one data type to another. Numeric functions can do arithmetic, mathematical, trigonometric, statistical, financial computations, generate random numbers. Character functions perform tasks like searching for strings, replacing strings or joining strings together, extracting a portion of a character value, counting how many words in a sentence. But sometimes, SAS users still cannot perform what they want by using the existing functions. For example, we can use tranwrd()to delete some characters in a string. Suppose we have a string name1, name2, name3, name4, name5, name6, somehow the string was entered like this name1,name2,,,name3,, name4,name5,,,,name6 we want to get rid of the extra, then tranwrd() only cannot do the job. But with the help of PROC FCMP, we can. What is PROC PCMP? PROC FCMP is a gift to SAS users who can use it to write their own functions and CALL routines or subroutines using DATA step syntax. Why it is a gift? Because it is a Base SAS procedure and you don t need to spend extra money on it as long as you have Base SAS. FCMP routines are stored in a SAS catalog and can be called from several SAS/STAT, SAS/ETS, and SAS/OR procedures. In SAS 9.2, FCMP routines can be called from DATA step. SAS users can use the SAS Function Compiler (FCMP) procedure to create, and store SAS functions, and subroutines before using them in other SAS procedures or DATA steps. Most features of the SAS programming language can be used in functions and subroutines. PROC FCMP functions and subroutines can be called from the DATA step just as any other SAS function, or subroutine, making it easier for SAS users to read, write, and maintain complex code with independent and reusable subroutines. The PROC FCMP routines can be reused in any DATA 1

2 step or SAS procedures. And the procedures include GENMOD, MCMC, NLMIXED, PHREG etc. even the Output Delivery System (ODS) Functions are independent computational blocks that require zero or more arguments. A subroutine is a special type of function that has no return value. The function begins with the FUNCTION statement, and the subroutine begins with the SUBROUTINE statement. A single FCMP procedure step can contain several functions and subroutines. The basic syntax is: PRCO FCMP OUTLIB=libname.dataset.package; Function body ; RETURN(expression); ENDSUB; or Subroutine body ; RETURN; ENDSUB; OUTLIB specifies the three-level name of an output data set to which the compiled functions and subroutines are written when the PROC FCMP step ends. And the functions and subroutines are saved in an output library. If the OUTLIB= is not used, then no functions and subroutines that are declared in the current PROC FCMP step are saved. A function body contains a function name, its arguments, and data step (code). The arguments are passed by value, which means that the value of the actual argument, variable, or value that is passed to the function from the calling environment is copied before being used by the function. This copying ensures that any modification of the formal argument by the function does not change the original value. Data step code specifies the tasks to be performed by the function. The RETURN statement is used to return a value to a function. The RETURN statement uses an expression enclosed in parentheses, and contains the value that is returned to the calling environment. The function declaration ends with an ENDSUB statement. The subroutine begins with the SUBROUTINE keyword instead of the FUNCTION keyword. A subroutine body contains a subroutine name, its arguments, and data step (code). The arguments are passed by reference and are listed in the OUTARGS statement, which means that any modification of the argument will modify the original variable that was passed. A RETURN statement in a subroutine does not return a value. Data step code specifies the tasks to be performed by the subroutine. Unlike other SAS procedures or DATA steps, PROC FCMP doesn t take in data by using a data statement nor output data by using output statement. Data is typically transferred into and out of PROC FCMP routines by using parameters. In general, PUT statement can be used to see the results in the log. Now let s come to some examples, 2

3 Suppose we have survey data consisting of 9 questions with values from 1 to 4 each, measuring trust in 9 different things, 1 stands for A lot, 2 some, 3 a little and 4 not at all. Suppose we want to create a new variable TRUST with value of 1(trust, not 4) and 0(not trust, only 4) then we use proc fcmp outlib=sasuser.funcs.trial; function COMP(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9); COMP= (sum ((Q1 le 3), (Q2 le 3), (Q3 le 3), (Q4 le 3), (Q5 le 3), (Q6 le 3), (Q7 le 3), (Q8 le 3), (Q9 le 3)) = 9); return(comp); endsub; options cmplib=sasuser.funcs; data two; set one; TRUST = comp(q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9); run; outlib=sasuser.funcs.trial; Use this option when you want to save functions and subroutines in an output library. Otherwise functions and subroutines would not be saved.the function in the example is saved to the data set sasuser.funcs inside a package called trial. A package is a collection of related routines that are specified by the user. function COMP(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9); This statement says the function will perform some operations on this nine variables and the name of operations is called COMP. COMP=(sum ((Q1 le 3), (Q2 le 3), (Q3 le 3), (Q4 le 3), (Q5 le 3), (Q6 le 3), (Q7 le 3), (Q8 le 3), (Q9 le 3)) = 9); This says what exactly the function will be doing. Q le 3 is a logical statement and it returns either 1 if the statement is true: that is Q is less than 3 or 0 if the statement is false: that is Q is not less than 3. If these 9 logical statements are all true, then the sum will be 9, making COMP =1; If one of these 9 logical statements are not true, then the sum will not be 9, making COMP =0. return(comp) will return the value of COMP to the calling environment. endsub is used to close the function. Before the data step, cmplib=sasuser.funcs is specified to tell SAS where to look for the function of COMP. In the data step, the function is called. And the variable TRUST takes the values from COMP. The second example: Suppose we have a string name1,name2,,,name3,, name4,name5,,,,name6 but we only want one comma to separate each name name1, name2, name3, name4, name5, name6, then we can get it done by using proc fcmp outlib=work.myfuncs.char; subroutine decomma(string $); outargs string; string=tranwrd(string,",,",","); if index(string,",,") > 0 then call decomma(string); endsub; quit; options cmplib=work.myfuncs; data _null_; list="namel,name2,,name3,,,name4,name5,,name6,,,,,namex"; call decomma(list); 3

4 put list=; run; outlib=work.myfuncs.char; Use this option when you want to save functions and subroutines in an output library. Otherwise functions and subroutines would not be saved. The subroutine in the example is saved to the data set work.myfuncs inside a package called char. A package is a collection of related routines that are specified by the user. subroutine decomma(string $); This statement says the subroutine will perform some operations on this string and the name of operations is call decomma. Since it is a string, a $ sign must be used. outargs string; After subroutine statement, outargs must be used and the argument in outargs is returned through a reference. string=tranwrd(string,",,",","); if index(string,",,") > 0 then call decomma(string); This says what exactly the subroutine will be doing. TRANWRD function is used to remove repeated commas in text. index(string,",,") > 0 says,, is found. call decomma(string) says remove it. Endsub It is used to close the function. Before the data step, cmplib=work.myfuncs is specified to tell SAS where to look for the subroutine of decomma. In the data step, the subroutine is called to perform the task of removing the extra comma. You can see the results by issuing a PUT statement. The third example: SAS doesn t have some functions that MS Excel has. But they are available by using PROC FCMP and you will find that MS Excel has a vast repertoire of functions. By issuing the following code, those excel functions become handy. PROC FCMP INLIB=sashelp.slkwxl LISTALL; RUN; Here is the list of the functions: Function avedev_slk ( data ) Function devsq_slk ( data ) Function varp_slk ( data ) Function even_slk ( x ) Function factdoule_silk ( x ) Function floor_slk ( n, sg ) Function multinormial_slk ( nums ) Function odd_slk ( x ) Function product_slk ( nums ) Function accrint_slk ( issue, finterest, settlement, rate, par, freq, basis ) Function accrintm_slk ( issue, maturity, rate, par, basis ) Function amordegrc_slk ( cost, datep, fperiod, salvage, period, rate,basis ) Function amorlinc_slk ( cost, datep, fperiod, salvage, period, rate, basis ) Function coupdaybs_slk ( settlement, maturity, freq, basis ) Function coupdays_slk ( settlement, maturity, freq, basis ) Function coupdaysnc_slk ( settlement, maturity, freq, basis ) Function coupncd_slk ( settlement, maturity, freq, basis ) Before you use the excel functions in SAS, you should specify cmplib=sasuser.funcs to tell SAS where to look for the excel function. In the data step, the function is called. For example, you can call product_skl function. The product function multiplies all the numbers given as arguments and returns the product. In SAS, the arguments must take an array in product function. OPTIONS CMPLIB = sashelp.slkwxl; 4

5 DATA _NULL_; array x[5] ( ); product = product_slk(x); PUT 'Product is ' product; RUN; You will see Product is 720 in the log. These three examples have given you an idea about the basics of PROC FCMP. You definitely can create your own functions and make use of Excel functions in SAS now. CONCLUSION This paper covers the very basics of the FCMP procedure. There are more topics about the FCMP procedure, like function editor, SELECT statements in PROC SQL, matrix operation, calling C function, etc. Readers can go to reference material listed below for further study. With the FCMP procedure, you can get more functionalities out of SAS and solve problems otherwise difficult or impossible. REFERENCE SAS Institute Inc The FCMP Procedure. Cary, NC: SAS Institute Inc. Secosky, Jason, 2007, User-Written DATA Step Functions, published in the Proceedings of the SAS Global Forum 2007 Conference, Cary, NC: SAS Institute Inc., CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Dachao Liu Northwestern University Suite N Lake Shore Dr. Chicago, IL Phone (312) dachao-liu@northwestern.edu SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. Other brand and product names are trademarks of their respective companies 5

The new SAS 9.2 FCMP Procedure, what functions are in your future? John H. Adams, Boehringer Ingelheim Pharmaceutical, Inc.

The new SAS 9.2 FCMP Procedure, what functions are in your future? John H. Adams, Boehringer Ingelheim Pharmaceutical, Inc. PharmaSUG2010 - Paper AD02 The new SAS 9.2 FCMP Procedure, what functions are in your future? John H. Adams, Boehringer Ingelheim Pharmaceutical, Inc., Ridgefield, CT ABSTRACT Our company recently decided

More information

User-Written DATA Step Functions Jason Secosky, SAS Institute Inc., Cary, NC

User-Written DATA Step Functions Jason Secosky, SAS Institute Inc., Cary, NC Paper TU10 User-Written DATA Step Functions Jason Secosky, SAS Institute Inc., Cary, NC Presented at SESUG 2007 by Robert Ray of SAS ABSTRACT For years, users have asked for the ability to write functions

More information

Helping You C What You Can Do with SAS

Helping You C What You Can Do with SAS ABSTRACT Paper SAS1747-2015 Helping You C What You Can Do with SAS Andrew Henrick, Donald Erdman, and Karen Croft, SAS Institute Inc., Cary, NC SAS users are already familiar with the FCMP procedure and

More information

Functions vs. Macros: A Comparison and Summary

Functions vs. Macros: A Comparison and Summary Functions vs. Macros: A Comparison and Summary Mahipal Vanam Phaneendhar Vanam Srinivas Vanam Percept Pharma Services, Bridgewater, NJ ABSTRACT SAS is rich in various built-in functions, and predefined

More information

Using PROC FCMP to the Fullest: Getting Started and Doing More

Using PROC FCMP to the Fullest: Getting Started and Doing More Paper 2403-2018 Using PROC FCMP to the Fullest: Getting Started and Doing More Arthur L. Carpenter California Occidental Consultants, Anchorage, AK ABSTRACT The FCMP procedure is used to create user defined

More information

Using PROC FCMP to the Fullest: Getting Started and Doing More

Using PROC FCMP to the Fullest: Getting Started and Doing More Paper HT02-2013 Using PROC FCMP to the Fullest: Getting Started and Doing More Arthur L. Carpenter California Occidental Consultants, Anchorage, AK ABSTRACT The FCMP procedure is used to create user defined

More information

TIPS AND TRICKS: IMPROVE EFFICIENCY TO YOUR SAS PROGRAMMING

TIPS AND TRICKS: IMPROVE EFFICIENCY TO YOUR SAS PROGRAMMING TIPS AND TRICKS: IMPROVE EFFICIENCY TO YOUR SAS PROGRAMMING Guillaume Colley, Lead Data Analyst, BCCFE Page 1 Contents Customized SAS Session Run system options as SAS starts Labels management Shortcut

More information

Submitting SAS Code On The Side

Submitting SAS Code On The Side ABSTRACT PharmaSUG 2013 - Paper AD24-SAS Submitting SAS Code On The Side Rick Langston, SAS Institute Inc., Cary NC This paper explains the new DOSUBL function and how it can submit SAS code to run "on

More information

Data Manipulation with SQL Mara Werner, HHS/OIG, Chicago, IL

Data Manipulation with SQL Mara Werner, HHS/OIG, Chicago, IL Paper TS05-2011 Data Manipulation with SQL Mara Werner, HHS/OIG, Chicago, IL Abstract SQL was developed to pull together information from several different data tables - use this to your advantage as you

More information

Using a Picture Format to Create Visit Windows

Using a Picture Format to Create Visit Windows SCSUG 2018 Using a Picture Format to Create Visit Windows Richann Watson, DataRich Consulting ABSTRACT Creating visit windows is sometimes required for analysis of data. We need to make sure that we get

More information

RUN_MACRO Run! With PROC FCMP and the RUN_MACRO Function from SAS 9.2, Your SAS Programs Are All Grown Up

RUN_MACRO Run! With PROC FCMP and the RUN_MACRO Function from SAS 9.2, Your SAS Programs Are All Grown Up ABSTRACT Paper BON-02 RUN_MACRO Run! With PROC FCMP and the RUN_MACRO Function from SAS 9.2, Your SAS Programs Are All Grown Up Dylan Ellis, Mathematica Policy Research, Washington, DC When SAS first came

More information

Imelda C. Go, South Carolina Department of Education, Columbia, SC

Imelda C. Go, South Carolina Department of Education, Columbia, SC PO 082 Rounding in SAS : Preventing Numeric Representation Problems Imelda C. Go, South Carolina Department of Education, Columbia, SC ABSTRACT As SAS programmers, we come from a variety of backgrounds.

More information

Functions. Lecture 6 COP 3014 Spring February 11, 2018

Functions. Lecture 6 COP 3014 Spring February 11, 2018 Functions Lecture 6 COP 3014 Spring 2018 February 11, 2018 Functions A function is a reusable portion of a program, sometimes called a procedure or subroutine. Like a mini-program (or subprogram) in its

More information

Excel Lesson 3 USING FORMULAS & FUNCTIONS

Excel Lesson 3 USING FORMULAS & FUNCTIONS Excel Lesson 3 USING FORMULAS & FUNCTIONS 1 OBJECTIVES Enter formulas in a worksheet Understand cell references Copy formulas Use functions Review and edit formulas 2 INTRODUCTION The value of a spreadsheet

More information

Are you Still Afraid of Using Arrays? Let s Explore their Advantages

Are you Still Afraid of Using Arrays? Let s Explore their Advantages Paper CT07 Are you Still Afraid of Using Arrays? Let s Explore their Advantages Vladyslav Khudov, Experis Clinical, Kharkiv, Ukraine ABSTRACT At first glance, arrays in SAS seem to be a complicated and

More information

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer

More information

A Quick and Gentle Introduction to PROC SQL

A Quick and Gentle Introduction to PROC SQL ABSTRACT Paper B2B 9 A Quick and Gentle Introduction to PROC SQL Shane Rosanbalm, Rho, Inc. Sam Gillett, Rho, Inc. If you are afraid of SQL, it is most likely because you haven t been properly introduced.

More information

What s New in SAS Studio?

What s New in SAS Studio? ABSTRACT Paper SAS1832-2015 What s New in SAS Studio? Mike Porter, Amy Peters, and Michael Monaco, SAS Institute Inc., Cary, NC If you have not had a chance to explore SAS Studio yet, or if you re anxious

More information

Let Hash SUMINC Count For You Joseph Hinson, Accenture Life Sciences, Berwyn, PA, USA

Let Hash SUMINC Count For You Joseph Hinson, Accenture Life Sciences, Berwyn, PA, USA ABSTRACT PharmaSUG 2014 - Paper CC02 Let Hash SUMINC Count For You Joseph Hinson, Accenture Life Sciences, Berwyn, PA, USA Counting of events is inevitable in clinical programming and is easily accomplished

More information

Unit E Step-by-Step: Programming with Python

Unit E Step-by-Step: Programming with Python Unit E Step-by-Step: Programming with Python Computer Concepts 2016 ENHANCED EDITION 1 Unit Contents Section A: Hello World! Python Style Section B: The Wacky Word Game Section C: Build Your Own Calculator

More information

Paper ###-YYYY. SAS Enterprise Guide: A Revolutionary Tool! Jennifer First, Systems Seminar Consultants, Madison, WI

Paper ###-YYYY. SAS Enterprise Guide: A Revolutionary Tool! Jennifer First, Systems Seminar Consultants, Madison, WI Paper ###-YYYY SAS Enterprise Guide: A Revolutionary Tool! Jennifer First, Systems Seminar Consultants, Madison, WI ABSTRACT Whether you are a novice or a pro with SAS, Enterprise Guide has something for

More information

Syntax Conventions for SAS Programming Languages

Syntax Conventions for SAS Programming Languages Syntax Conventions for SAS Programming Languages SAS Syntax Components Keywords A keyword is one or more literal name components of a language element. Keywords are uppercase, and in reference documentation,

More information

Square Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint

Square Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint PharmaSUG 2018 - Paper DV-01 Square Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint Jane Eslinger, SAS Institute Inc. ABSTRACT An output table is a square. A slide

More information

How to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U?

How to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U? Paper 54-25 How to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U? Andrew T. Kuligowski Nielsen Media Research Abstract / Introduction S-M-U. Some people will see these three letters and

More information

IF there is a Better Way than IF-THEN

IF there is a Better Way than IF-THEN PharmaSUG 2018 - Paper QT-17 IF there is a Better Way than IF-THEN Bob Tian, Anni Weng, KMK Consulting Inc. ABSTRACT In this paper, the author compares different methods for implementing piecewise constant

More information

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n) Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 10A Lecture - 20 What is a function?

More information

Copy That! Using SAS to Create Directories and Duplicate Files

Copy That! Using SAS to Create Directories and Duplicate Files Copy That! Using SAS to Create Directories and Duplicate Files, SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and

More information

My Reporting Requires a Full Staff Help!

My Reporting Requires a Full Staff Help! ABSTRACT Paper GH-03 My Reporting Requires a Full Staff Help! Erin Lynch, Daniel O Connor, Himesh Patel, SAS Institute Inc., Cary, NC With cost cutting and reduced staff, everyone is feeling the pressure

More information

Unlock SAS Code Automation with the Power of Macros

Unlock 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 information

Java Methods. Lecture 8 COP 3252 Summer May 23, 2017

Java Methods. Lecture 8 COP 3252 Summer May 23, 2017 Java Methods Lecture 8 COP 3252 Summer 2017 May 23, 2017 Java Methods In Java, the word method refers to the same kind of thing that the word function is used for in other languages. Specifically, a method

More information

Journey to the center of the earth Deep understanding of SAS language processing mechanism Di Chen, SAS Beijing R&D, Beijing, China

Journey to the center of the earth Deep understanding of SAS language processing mechanism Di Chen, SAS Beijing R&D, Beijing, China Journey to the center of the earth Deep understanding of SAS language processing Di Chen, SAS Beijing R&D, Beijing, China ABSTRACT SAS is a highly flexible and extensible programming language, and a rich

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

How to Create Data-Driven Lists

How to Create Data-Driven Lists Paper 9540-2016 How to Create Data-Driven Lists Kate Burnett-Isaacs, Statistics Canada ABSTRACT As SAS programmers we often want our code or program logic to be driven by the data at hand, rather than

More information

SAS 9 Programming Enhancements Marje Fecht, Prowerk Consulting Ltd Mississauga, Ontario, Canada

SAS 9 Programming Enhancements Marje Fecht, Prowerk Consulting Ltd Mississauga, Ontario, Canada SAS 9 Programming Enhancements Marje Fecht, Prowerk Consulting Ltd Mississauga, Ontario, Canada ABSTRACT Performance improvements are the well-publicized enhancement to SAS 9, but what else has changed

More information

Getting it Done with PROC TABULATE

Getting it Done with PROC TABULATE ABSTRACT Getting it Done with PROC TABULATE Michael J. Williams, ICON Clinical Research, San Francisco, CA The task of displaying statistical summaries of different types of variables in a single table

More information

Using Templates Created by the SAS/STAT Procedures

Using Templates Created by the SAS/STAT Procedures Paper 081-29 Using Templates Created by the SAS/STAT Procedures Yanhong Huang, Ph.D. UMDNJ, Newark, NJ Jianming He, Solucient, LLC., Berkeley Heights, NJ ABSTRACT SAS procedures provide a large quantity

More information

DATA Step in SAS Viya : Essential New Features

DATA Step in SAS Viya : Essential New Features Paper SAS118-2017 DATA Step in SAS Viya : Essential New Features Jason Secosky, SAS Institute Inc., Cary, NC ABSTRACT The is the familiar and powerful data processing language in SAS and now SAS Viya.

More information

Chapter 28 Saving and Printing Tables. Chapter Table of Contents SAVING AND PRINTING TABLES AS OUTPUT OBJECTS OUTPUT OBJECTS...

Chapter 28 Saving and Printing Tables. Chapter Table of Contents SAVING AND PRINTING TABLES AS OUTPUT OBJECTS OUTPUT OBJECTS... Chapter 28 Saving and Printing Tables Chapter Table of Contents SAVING AND PRINTING TABLES AS OUTPUT OBJECTS...418 OUTPUT OBJECTS...422 415 Part 2. Introduction 416 Chapter 28 Saving and Printing Tables

More information

Fifteen Functions to Supercharge Your SAS Code

Fifteen Functions to Supercharge Your SAS Code MWSUG 2017 - Paper BB071 Fifteen Functions to Supercharge Your SAS Code Joshua M. Horstman, Nested Loop Consulting, Indianapolis, IN ABSTRACT The number of functions included in SAS software has exploded

More information

Streamline Table Lookup by Embedding HASH in FCMP Qing Liu, Eli Lilly & Company, Shanghai, China

Streamline Table Lookup by Embedding HASH in FCMP Qing Liu, Eli Lilly & Company, Shanghai, China ABSTRACT PharmaSUG China 2017 - Paper 19 Streamline Table Lookup by Embedding HASH in FCMP Qing Liu, Eli Lilly & Company, Shanghai, China SAS provides many methods to perform a table lookup like Merge

More information

Advanced Programming Techniques Using the DS2 Procedure

Advanced Programming Techniques Using the DS2 Procedure Paper 1976-2018 Advanced Programming Techniques Using the DS2 Procedure Viraj Kumbhakarna, MUFG Union Bank N.A. ABSTRACT DS2 is a SAS proprietary programming language appropriate for advanced data manipulation.

More information

Coding Workshop. Learning to Program with an Arduino. Lecture Notes. Programming Introduction Values Assignment Arithmetic.

Coding Workshop. Learning to Program with an Arduino. Lecture Notes. Programming Introduction Values Assignment Arithmetic. Coding Workshop Learning to Program with an Arduino Lecture Notes Table of Contents Programming ntroduction Values Assignment Arithmetic Control Tests f Blocks For Blocks Functions Arduino Main Functions

More information

Using SAS with Oracle : Writing efficient and accurate SQL Tasha Chapman and Lori Carleton, Oregon Department of Consumer and Business Services

Using SAS with Oracle : Writing efficient and accurate SQL Tasha Chapman and Lori Carleton, Oregon Department of Consumer and Business Services Using SAS with Oracle : Writing efficient and accurate SQL Tasha Chapman and Lori Carleton, Oregon Department of Consumer and Business Services When using SAS to extract data from a live Oracle database,

More information

Enterprise Client Software for the Windows Platform

Enterprise Client Software for the Windows Platform Paper 154 Enterprise Client Software for the Windows Platform Gail Kramer, SAS Institute Inc., Cary, NC Carol Rigsbee, SAS Institute Inc., Cary, NC John Toebes, SAS Institute Inc., Cary, NC Jeff Polzin,

More information

SAS Online Training: Course contents: Agenda:

SAS Online Training: Course contents: Agenda: SAS Online Training: Course contents: Agenda: (1) Base SAS (6) Clinical SAS Online Training with Real time Projects (2) Advance SAS (7) Financial SAS Training Real time Projects (3) SQL (8) CV preparation

More information

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0. L J Howell UX Software Ver. 1.0

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0. L J Howell UX Software Ver. 1.0 VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 L J Howell UX Software 2009 Ver. 1.0 TABLE OF CONTENTS INTRODUCTION...ii What is this book about?... iii How to use this book... iii

More information

ABSTRACT: INTRODUCTION: WEB CRAWLER OVERVIEW: METHOD 1: WEB CRAWLER IN SAS DATA STEP CODE. Paper CC-17

ABSTRACT: INTRODUCTION: WEB CRAWLER OVERVIEW: METHOD 1: WEB CRAWLER IN SAS DATA STEP CODE. Paper CC-17 Paper CC-17 Your Friendly Neighborhood Web Crawler: A Guide to Crawling the Web with SAS Jake Bartlett, Alicia Bieringer, and James Cox PhD, SAS Institute Inc., Cary, NC ABSTRACT: The World Wide Web has

More information

A Generalized Macro-Based Data Reporting System to Produce Both HTML and Text Files

A Generalized Macro-Based Data Reporting System to Produce Both HTML and Text Files A Generalized Macro-Based Data Reporting System to Produce Both HTML and Text Files Jeff F. Sun, Blue Cross Blue Shield of North Carolina, Durham, North Carolina Abstract This paper will address the inter-connection

More information

Chapter 3 - Simple JavaScript - Programming Basics. Lesson 1 - JavaScript: What is it and what does it look like?

Chapter 3 - Simple JavaScript - Programming Basics. Lesson 1 - JavaScript: What is it and what does it look like? Chapter 3 - Simple JavaScript - Programming Basics Lesson 1 - JavaScript: What is it and what does it look like? PP presentation JavaScript.ppt. Lab 3.1. Lesson 2 - JavaScript Comments, document.write(),

More information

ABSTRACT MORE THAN SYNTAX ORGANIZE YOUR WORK THE SAS ENTERPRISE GUIDE PROJECT. Paper 50-30

ABSTRACT MORE THAN SYNTAX ORGANIZE YOUR WORK THE SAS ENTERPRISE GUIDE PROJECT. Paper 50-30 Paper 50-30 The New World of SAS : Programming with SAS Enterprise Guide Chris Hemedinger, SAS Institute Inc., Cary, NC Stephen McDaniel, SAS Institute Inc., Cary, NC ABSTRACT SAS Enterprise Guide (with

More information

9 Ways to Join Two Datasets David Franklin, Independent Consultant, New Hampshire, USA

9 Ways to Join Two Datasets David Franklin, Independent Consultant, New Hampshire, USA 9 Ways to Join Two Datasets David Franklin, Independent Consultant, New Hampshire, USA ABSTRACT Joining or merging data is one of the fundamental actions carried out when manipulating data to bring it

More information

CHAPTER 7 Using Other SAS Software Products

CHAPTER 7 Using Other SAS Software Products 77 CHAPTER 7 Using Other SAS Software Products Introduction 77 Using SAS DATA Step Features in SCL 78 Statements 78 Functions 79 Variables 79 Numeric Variables 79 Character Variables 79 Expressions 80

More information

Chapter 2 Basic Elements of C++

Chapter 2 Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion

More information

DOWNLOAD PDF MICROSOFT EXCEL ALL FORMULAS LIST WITH EXAMPLES

DOWNLOAD PDF MICROSOFT EXCEL ALL FORMULAS LIST WITH EXAMPLES Chapter 1 : Examples of commonly used formulas - Office Support A collection of useful Excel formulas for sums and counts, dates and times, text manipularion, conditional formatting, percentages, Excel

More information

Data Representation. Variable Precision and Storage Information. Numeric Variables in the Alpha Environment CHAPTER 9

Data Representation. Variable Precision and Storage Information. Numeric Variables in the Alpha Environment CHAPTER 9 199 CHAPTER 9 Data Representation Variable Precision and Storage Information 199 Numeric Variables in the Alpha Environment 199 Numeric Variables in the VAX Environment 200 Missing Values 201 Variable

More information

Tweaking your tables: Suppressing superfluous subtotals in PROC TABULATE

Tweaking your tables: Suppressing superfluous subtotals in PROC TABULATE ABSTRACT Tweaking your tables: Suppressing superfluous subtotals in PROC TABULATE Steve Cavill, NSW Bureau of Crime Statistics and Research, Sydney, Australia PROC TABULATE is a great tool for generating

More information

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently.

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently. 255 APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software Introduction 255 Generating a QMF Export Procedure 255 Exporting Queries from QMF 257 Importing QMF Queries into Query and Reporting 257 Alternate

More information

Using Metadata Queries To Build Row-Level Audit Reports in SAS Visual Analytics

Using Metadata Queries To Build Row-Level Audit Reports in SAS Visual Analytics SAS6660-2016 Using Metadata Queries To Build Row-Level Audit Reports in SAS Visual Analytics ABSTRACT Brandon Kirk and Jason Shoffner, SAS Institute Inc., Cary, NC Sensitive data requires elevated security

More information

Can you decipher the code? If you can, maybe you can break it. Jay Iyengar, Data Systems Consultants LLC, Oak Brook, IL

Can you decipher the code? If you can, maybe you can break it. Jay Iyengar, Data Systems Consultants LLC, Oak Brook, IL Paper 11667-2016 Can you decipher the code? If you can, maybe you can break it. Jay Iyengar, Data Systems Consultants LLC, Oak Brook, IL ABSTRACT You would think that training as a code breaker, similar

More information

Paper HOW-06. Tricia Aanderud, And Data Inc, Raleigh, NC

Paper HOW-06. Tricia Aanderud, And Data Inc, Raleigh, NC Paper HOW-06 Building Your First SAS Stored Process Tricia Aanderud, And Data Inc, Raleigh, NC ABSTRACT Learn how to convert a simple SAS macro into three different stored processes! Using examples from

More information

HOW TO DEVELOP A SAS/AF APPLICATION

HOW TO DEVELOP A SAS/AF APPLICATION PS001 Creating Effective Graphical User Interfaces Using Version 8 SAS/AF Anders Longthorne, National Highway Traffic Safety Administration, Washington, DC ABSTRACT Improving access to an organization

More information

Variables and numeric types

Variables and numeric types s s and numeric types Comp Sci 1570 to C++ types Outline s types 1 2 s 3 4 types 5 6 Outline s types 1 2 s 3 4 types 5 6 s types Most programs need to manipulate data: input values, output values, store

More information

Merging Data Eight Different Ways

Merging Data Eight Different Ways Paper 197-2009 Merging Data Eight Different Ways David Franklin, Independent Consultant, New Hampshire, USA ABSTRACT Merging data is a fundamental function carried out when manipulating data to bring it

More information

How to approach a computational problem

How to approach a computational problem How to approach a computational problem A lot of people find computer programming difficult, especially when they first get started with it. Sometimes the problems are problems specifically related to

More information

SAS ENTERPRISE GUIDE USER INTERFACE

SAS ENTERPRISE GUIDE USER INTERFACE Paper 294-2008 What s New in the 4.2 releases of SAS Enterprise Guide and the SAS Add-In for Microsoft Office I-kong Fu, Lina Clover, and Anand Chitale, SAS Institute Inc., Cary, NC ABSTRACT SAS Enterprise

More information

KEYWORDS Metadata, macro language, CALL EXECUTE, %NRSTR, %TSLIT

KEYWORDS Metadata, macro language, CALL EXECUTE, %NRSTR, %TSLIT MWSUG 2017 - Paper BB15 Building Intelligent Macros: Driving a Variable Parameter System with Metadata Arthur L. Carpenter, California Occidental Consultants, Anchorage, Alaska ABSTRACT When faced with

More information

Anyone Can Learn PROC TABULATE, v2.0

Anyone Can Learn PROC TABULATE, v2.0 Paper 63-25 Anyone Can Learn PROC TABULATE, v2.0 Lauren Haworth Ischemia Research & Education Foundation San Francisco ABSTRACT SAS Software provides hundreds of ways you can analyze your data. You can

More information

Formulas, LookUp Tables and PivotTables Prepared for Aero Controlex

Formulas, LookUp Tables and PivotTables Prepared for Aero Controlex Basic Topics: Formulas, LookUp Tables and PivotTables Prepared for Aero Controlex Review ribbon terminology such as tabs, groups and commands Navigate a worksheet, workbook, and multiple workbooks Prepare

More information

Easing into Data Exploration, Reporting, and Analytics Using SAS Enterprise Guide

Easing into Data Exploration, Reporting, and Analytics Using SAS Enterprise Guide Paper 809-2017 Easing into Data Exploration, Reporting, and Analytics Using SAS Enterprise Guide ABSTRACT Marje Fecht, Prowerk Consulting Whether you have been programming in SAS for years, are new to

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA

Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA SESUG 2012 Paper HW-01 Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA ABSTRACT Learning the basics of PROC REPORT can help the new SAS user avoid hours of headaches.

More information

Using the SQL Editor. Overview CHAPTER 11

Using the SQL Editor. Overview CHAPTER 11 205 CHAPTER 11 Using the SQL Editor Overview 205 Opening the SQL Editor Window 206 Entering SQL Statements Directly 206 Entering an SQL Query 206 Entering Non-SELECT SQL Code 207 Creating Template SQL

More information

Files Arriving at an Inconvenient Time? Let SAS Process Your Files with FILEEXIST While You Sleep

Files Arriving at an Inconvenient Time? Let SAS Process Your Files with FILEEXIST While You Sleep Files Arriving at an Inconvenient Time? Let SAS Process Your Files with FILEEXIST While You Sleep Educational Testing Service SAS and all other SAS Institute Inc. product or service names are registered

More information

A Format to Make the _TYPE_ Field of PROC MEANS Easier to Interpret Matt Pettis, Thomson West, Eagan, MN

A Format to Make the _TYPE_ Field of PROC MEANS Easier to Interpret Matt Pettis, Thomson West, Eagan, MN Paper 045-29 A Format to Make the _TYPE_ Field of PROC MEANS Easier to Interpret Matt Pettis, Thomson West, Eagan, MN ABSTRACT: PROC MEANS analyzes datasets according to the variables listed in its Class

More information

How to Implement the One-Time Methodology Mark Tabladillo, Ph.D., Atlanta, GA

How to Implement the One-Time Methodology Mark Tabladillo, Ph.D., Atlanta, GA How to Implement the One-Time Methodology Mark Tabladillo, Ph.D., Atlanta, GA ABSTRACT This tutorial will demonstrate how to implement the One-Time Methodology, a way to manage, validate, and process survey

More information

Unit 7. Functions. Need of User Defined Functions

Unit 7. Functions. Need of User Defined Functions Unit 7 Functions Functions are the building blocks where every program activity occurs. They are self contained program segments that carry out some specific, well defined task. Every C program must have

More information

ABSTRACT INTRODUCTION THE ODS TAGSET FACILITY

ABSTRACT INTRODUCTION THE ODS TAGSET FACILITY Graphs in Flash Using the Graph Template Language Himesh Patel, SAS Institute Inc., Cary, NC David Kelley, SAS Institute Inc., Cary, NC Dan Heath, SAS Institute Inc., Cary, NC ABSTRACT The Graph Template

More information

Computer Science Lab Exercise 1

Computer Science Lab Exercise 1 1 of 10 Computer Science 127 - Lab Exercise 1 Introduction to Excel User-Defined Functions (pdf) During this lab you will experiment with creating Excel user-defined functions (UDFs). Background We use

More information

SAMLab Tip Sheet #1 Translating Mathematical Formulas Into Excel s Language

SAMLab Tip Sheet #1 Translating Mathematical Formulas Into Excel s Language Translating Mathematical Formulas Into Excel s Language Introduction Microsoft Excel is a very powerful calculator; you can use it to compute a wide variety of mathematical expressions. Before exploring

More information

An Application of PROC NLP to Survey Sample Weighting

An Application of PROC NLP to Survey Sample Weighting An Application of PROC NLP to Survey Sample Weighting Talbot Michael Katz, Analytic Data Information Technologies, New York, NY ABSTRACT The classic weighting formula for survey respondents compensates

More information

SIMPLE INPUT and OUTPUT:

SIMPLE INPUT and OUTPUT: SIMPLE INPUT and OUTPUT: (A) Printing to the screen. The disp( ) command. If you want to print out the values of a variable to the screen, you simply can type the variable at the command line. > x = 5

More information

DBLOAD Procedure Reference

DBLOAD Procedure Reference 131 CHAPTER 10 DBLOAD Procedure Reference Introduction 131 Naming Limits in the DBLOAD Procedure 131 Case Sensitivity in the DBLOAD Procedure 132 DBLOAD Procedure 132 133 PROC DBLOAD Statement Options

More information

External Files. Definition CHAPTER 38

External Files. Definition CHAPTER 38 525 CHAPTER 38 External Files Definition 525 Referencing External Files Directly 526 Referencing External Files Indirectly 526 Referencing Many Files Efficiently 527 Referencing External Files with Other

More information

Going Under the Hood: How Does the Macro Processor Really Work?

Going 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 information

Procedures (Subroutines) and Functions

Procedures (Subroutines) and Functions VISUAL BASIC Procedures (Subroutines) and Functions Copyright 2014 Dan McElroy Procedures and Functions Serve Two Purposes They allow a programmer to say: `this piece of code does a specific job which

More information

Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word

Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word These instructions assume that you are familiar with using MS Word for ordinary word processing *. If you are not comfortable entering

More information

Unit 3. Operators. School of Science and Technology INTRODUCTION

Unit 3. Operators. School of Science and Technology INTRODUCTION INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.

More information

An Application of ODS Tagsets. Notice! Paper

An Application of ODS Tagsets. Notice! Paper An Application of ODS Tagsets Paper 178-27 Jack Hamilton First Health Notice! For detailed code, look at my paper in the Proceedings. I have taken to heart Edward Tufte's advice that there's no point in

More information

Programming Beyond the Basics. Find() the power of Hash - How, Why and When to use the SAS Hash Object John Blackwell

Programming Beyond the Basics. Find() the power of Hash - How, Why and When to use the SAS Hash Object John Blackwell Find() the power of Hash - How, Why and When to use the SAS Hash Object John Blackwell ABSTRACT The SAS hash object has come of age in SAS 9.2, giving the SAS programmer the ability to quickly do things

More information

Using Dynamic Data Exchange

Using Dynamic Data Exchange 145 CHAPTER 8 Using Dynamic Data Exchange Overview of Dynamic Data Exchange 145 DDE Syntax within SAS 145 Referencing the DDE External File 146 Determining the DDE Triplet 146 Controlling Another Application

More information

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed

More information

SAS Visual Analytics Environment Stood Up? Check! Data Automatically Loaded and Refreshed? Not Quite

SAS Visual Analytics Environment Stood Up? Check! Data Automatically Loaded and Refreshed? Not Quite Paper SAS1952-2015 SAS Visual Analytics Environment Stood Up? Check! Data Automatically Loaded and Refreshed? Not Quite Jason Shoffner, SAS Institute Inc., Cary, NC ABSTRACT Once you have a SAS Visual

More information

Lecture 5: Methods CS2301

Lecture 5: Methods CS2301 Lecture 5: Methods NADA ALZAHRANI CS2301 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively. 2 Solution public static int sum(int i1, int i2) { int

More information

Using Data Set Options in PROC SQL Kenneth W. Borowiak Howard M. Proskin & Associates, Inc., Rochester, NY

Using Data Set Options in PROC SQL Kenneth W. Borowiak Howard M. Proskin & Associates, Inc., Rochester, NY Using Data Set Options in PROC SQL Kenneth W. Borowiak Howard M. Proskin & Associates, Inc., Rochester, NY ABSTRACT Data set options are an often over-looked feature when querying and manipulating SAS

More information

SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD

SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD Paper BB-7 SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD ABSTRACT The SAS Macro Facility offers a mechanism for expanding and customizing

More information

Language Reference Manual

Language Reference Manual TAPE: A File Handling Language Language Reference Manual Tianhua Fang (tf2377) Alexander Sato (as4628) Priscilla Wang (pyw2102) Edwin Chan (cc3919) Programming Languages and Translators COMSW 4115 Fall

More information

SSEA Computer Science: Track A. Dr. Cynthia Lee Lecturer in Computer Science Stanford

SSEA Computer Science: Track A. Dr. Cynthia Lee Lecturer in Computer Science Stanford SSEA Computer Science: Track A Dr. Cynthia Lee Lecturer in Computer Science Stanford Topics for today Introduce Java programming language Assignment and type casting Expressions Operator precedence Code

More information

Use of Technology. Perform statistical computations on stored data or entered statistics.

Use of Technology. Perform statistical computations on stored data or entered statistics. Chapter 1 Introduction Use of Technology Statistics is a field that deals with sets of data. After the data is collected, it needs to be organized and interpreted. There is a limit to how much of the work

More information

How to Set up a Budget Advanced Excel Part B

How to Set up a Budget Advanced Excel Part B How to Set up a Budget Advanced Excel Part B A budget is probably the most important spreadsheet you can create. A good budget will keep you focused on your ultimate financial goal and help you avoid spending

More information