Introduction to SAS Functions

Size: px
Start display at page:

Download "Introduction to SAS Functions"

Transcription

1 Paper 57 Introduction to SAS Functions Neil Howard, Independent Consultant, Charlottesville, VA Abstract A FUNCTION returns a value from a computation or system manipulation that requires zero or more arguments. And, like most programming languages, the SAS System provides an extensive library of built-in functions. SAS has more than 190 functions for a variety of programming tasks. This tutorial will cover the syntax for invoking functions, an overview of the functions available, examples of commonly used functions, selected character handling and numeric functions, and some tricks and applications of functions that will surprise you. Breaking Down a FUNCTION - Syntax Given the above definition of a function, the syntax and components should be examined. A function recognized in a SAS statement by the use of a function name, followed immediately by function argument(s), separated by commas, and enclosed in parentheses. For a function requiring two arguments the syntax is as follows: FUNCTIONNAME(argument-1, argument-2) where the arguments are: constants variables expressions other functions Several functions take no arguments, in which case a null set of parentheses is required. For instance, the TODAY function returns today s date from the system clock, requiring no arguments: DATA NEW; X = TODAY() ; PUT X= X MMDDYY8. ; X= 01/18/99; The variable X is returned as the numeric SAS date representation and should be displayed with a format. Breaking Down a FUNCTION - Arguments The arguments to any given function can be variables, constants, expressions, and/or other functions. constant X = SQRT(9562) ; variable Y = ABS(BAL) ; expression Z = MAX((BAL-DEBIT),(NEWCAR+GAS)) ; function Q = ABS(SQRT(ABC-64)) ; In these examples, X is the square root of 9562, Y would be the absolute value of the variable BAL, Y contains the value of the larger of the two expressions, and Q is the absolute value of the square root of ABC minus 64. A similar numeric function, MIN, returns the value of the lowest of its nonmissing arguments. The SUM function requires at least two arguments and returns the sum of the nonmissing arguments. TOTAL = SUM( X, Y, Z ) ; Use of the keyword OF gives the user the flexibility to include variable lists, array elements and other shortcuits for referencing variable names. A = SUM( OF TEMP1 - TEMP24 ); B = SUM( OF TEMP1 TEMP2 TEMP3 ); C = SUM( OF TMPARRAY {*} ); D = SUM( OF _NUMERIC_ ); E = SUM( OF TEMP1 -- TEMP24 ); In the examples above, A gives you the total of 24 consecutive temperature readings where numbered variable names were used. Using no commas, you can sum three temperature value to calculate B. When an array named TMPARRAY has been defined, you can pass the elements to the SUM function to get C. All numeric variables in the program data vector (PDV) are added to produce D, and E is derived by adding all variables in placement order in the PDV between and including TEMP1 and TEMP24. Categories of FUNCTIONS The library of functions contains several categories of functions, including: arithmetic (like ABS, MIN, MAX, SQRT), array (e.g., DIM), character handling (e.g., LEFT, RIGHT, SUBSTR, REVERSE, LENGTH), date and time (e.g., TODAY, JULDATE, MDY, INTCK, TIMEPART), financial (e.g., MORT, NPV, SAVING), mathematical (e.g., LOG, EXP), probability (e.g., POISSON, PROBCHI), quantile, random number (e.g., NORMAL, UNIFORM),

2 sample statistics (e.g., MEAN, MIN, MAX, STD, NMISS), special functions (e.g., LAG, PUT INPUT), state and zip code, trigonometric and hyberbolic, and truncation (ROUND, CEIL, FLOOR). Chapter 11 of the SAS Language manual for the complete list and details. FUNCTIONS vs. PROCEDURES Some functions that are commonly used compute the sum (SUM), arithmetic mean (MEAN), variance (VAR), standard deviation (STD), minimum value (MIN), and maximum value (MAX). These functions compute the same simple descriptive statistics available in PROC MEANS, however. The fundamental difference between functions and procedures is that a function expects the argument values to supplied across an observation in a SAS data set. Procedures expects one variable value per observation. O B S E R V A T I O N S P R O C E D U R E S V A R I A B L E S F U N C T I O N S SAS Data Set The following code calculates the average temperature per day using the MEAN function executed for each observation. The resulting new data set and new variable AVGTEMP are passed to PROC MEANS to calculate the average temperature per month. Note that, not only if the variable list notation used as a shortcut for specifying the function arguments, the OF keyword prevents the argument specification from being misinterpreted as the expression T1 minus T24. data average ; set temp ; avgtemp = mean( of T1 - T24 ) ; run ; proc sort ; by month ; run ; proc means ; by month ; var avgtemp ; run ; Missing Values Remembering that functions must be used in SAS statements and that missing values propogate, be aware of how each function handles missing values. Rely on the SAS Language manual specs and your own programmatic testing code to validate your intended results. For example, the MEAN function will return the arithmetic average for the nonmissing arguments, using the number of nonmissings as the denominator. Likewise, SUM totals all the nonmissing arguments. However, if all the arguments are missing, the total will be missing, NOT zero, which could effect later calculations in your program. To force a zero total, include the constant on your calculation: X = SUM( A,B,C,D,E,F,0 ); Y = SUM( OF T1 - T24, 0 ); The functions NMISS and N allow you to determine the number of missing values and nonmissings, respectively, in the argument list. A = NMISS( A,B,C,D,E,F ); * # of missings; B = N( L,M,N,O,P ); * # of nonmissings; Length of Target Variables Target refers to the receiving variable on the left side of the equal sign in the SAS statement where a function is used on the right to calculate or otherwise produce a result. The default length for a numeric target is 8; however, for some character functions, the default length of the target variable is 200 or the length of the source variable (argument). The SCAN function returns a given word from a character string using default and specified delimiters. X = ABCDEFGHIJKLMNOPQRSTUVWXYZ ; Y = SCAN(X, 1, K ) ; PUT Y= ; Y = ABCDEFGHIJ In the example above, the variable X has a length of 26, and the SCAN function is searching X for the first word using K as the delimiter. A PROC CONTENTS run on the data set NEW will show the length for Y in the descriptor as 200. SUBSTR is a commonly used character handling function that extracts a string from an argument or replaces character value contents. The function takes three arguments: the source (or argument), the starting position in constant or variable form, and the length of the substring expressed as a constant or variable. SET OLD ; *** CONTAINS A B C; X = SUBSTR( A, 23, 4 ) ; Y = SUBSTR( A, B, 3 ) ;

3 Z = SUBSTR( A, 9, C ) ; PUT A= B= C= X= Y= Z= ; A = ABCDEFGHIJKLMNOPQRSTUVWXYZ B = 2 C = 9 X = WXYZ Z = IJKLMNOPQ A PROC CONTENTS of data set NEW would show that variable A is character with a length of 26, B and C are character with length of 8, and X, Y, and Z are character with lengths of 26. In the case of X and Y, a LENGTH statement coded before the assignment statements; it will reserve only the number of bytes needed in the PDV. Since the value of the variable C is unknown at compile time, the length of the source variable is used by default. Consider a case where data is received in 200-byte character chunks defined as variables. Hopefully, extensive documentation describes the layout for extracting the individual variable values. SET OLD ; **contains VAR_200; IDNUM = SUBSTR(VAR_200, 1, 10 ) ; NAME = SUBSTR(VAR_200, 11, 25) ; AGE = SUBSTR(VAR_200, 36, 2) ; For efficiency, be sure to DROP VAR_200 and code a length statement for the derived variables. Otherwise, IDNUM, NAME, and AGE will all have a default length of 200. Depending on the size of your data set, you may stress your DASD or disk space unnecessarily. Your data would also be difficult to work with in default condition. DATA NEW (DROP=VAR_200) ; SET OLD ; **contains VAR_200 ; LENGTH IDNUM $ 10 NAME $ 25 AGE $ 2 ; IDNUM = SUBSTR(VAR_200, 1, 10 ) ; NAME = SUBSTR(VAR_200, 11, 25) ; AGE = SUBSTR(VAR_200, 36, 2) ; The Version 5 story held that there were two types of functions: supervisor and library. Supervisor functions were part of the SAS supervisor (now the DATA step processor in Version 6). Library functions were external routines, linked to and invoked by the supervisor. Parameters were passed to them and results returned. Supervisor functions could know information about the argument at compile time and take action regarding the length of the target variable. Library functions do not interact with the calling environment so maximum character lengths were used as defaults. SCAN is the only function were the maximum is still return. This may not be an issue in future releases. More on SUBSTR(???) As mentioned, SUBSTR is an example of character string handling function. You cannot substring numerics, unless values were first converted to character, then passed to SUBSTR. Another less obvious solution is to use the MOD and INT numeric functions. The first argument to the MOD function is a numeric, the second is a non-zero numeric; the result is the remainder when the integer quotient of argument-1 is divided by argument-2. The INT function takes only one argument and returns the integer portion of an argument, truncating the decimal portion. Note that the argument can be an expression. A = ; X = INT( A/1000 ) ; Y = MOD( A, 1000 ) ; Z = MOD( INT( A/100 ), 100 ) ; PUT A= X= Y= Z= ; A= X=123 Y=456 Z=34 SUBSTR as a Pseudo-Variable In an old discussion on SAS-L, participants were intrigues by the use of SUBSTR as a pseudo-variable. If the function is used on the left side of the equal sign in an assignment statement, the SAS System places the value of the expression on the right into the argument of the SUBSTRed expression, beginning with the position you indicate with the second argument, for the length specified in the third argument. The following example is lifted from that SAS-L discussion, with apologies to the original author. DATA FIXIT; SET OLD; PUT NAME= '(Before)' ; WHERE = INDEX(NAME, 'Ratface' ) ; IF (WHERE = 0) THEN NAME = TRIM(NAME) ', Evil Genius' ; ELSE SUBSTR(NAME, WHERE, 13) = 'The Powerful' ; PUT WHERE= NAME= '(After)' ; (first execution) NAME = Duke Owen (Before) WHERE = 0 NAME = Duke Owen, Evil Genius (After) (second execution) NAME = Duke Ratface Owen (Before) WHERE = 6 NAME = Duke The Powerful (After)

4 Data Conversions The SAS log message stating that character values have been converted to numeric: or vice versa, politely advises you that you gave mixed your data types in a SAS statement, and, where possible, the DATA step processor has performed automatic conversions to make your transaction possible. The PUT and INPUT functions allow you to take control of these types of conversions, for clarity, accuracy, efficiency, and data integrity: PUT(source, format) INPUT(source, informat) The PUT function returns the value of source written with a specified format. The format type must match the source type (character or numeric). Note that the result of the PUT function al always a character string. The INPUT function allows you to read the source with a specified informat. The result can be character or numeric, depending on the informat. A = 1234 ; B = '789,321' ; X = PUT( A, 4. ) ; Y = INPUT( B, COMMA7. ) ; PUT X= ' CHARACTER' ; PUT Y= ' NUMERIC' ; X = 1234 CHARACTER Y = NUMERIC Table Lookup and More The PUT and INPUT functions are being cleverly used for a variety of data transformation applications. One such requirement is table lookup, made easy with the PUT function. PROC FORMAT ; VALUE REGFMT 1,5,6,9,11-15 = 'NW' 2,7,10 = 'SW' 3,4,8,16 = 'NE' = 'SE'; DATA RECODE ; INFILE DATA ; INPUT COUNTY POP ; REGION = PUT(COUNTY, REGFMT. ) ; PROC SORT ; BY REGION ; PROC PRINT ; BY REGION ; VAR POP ; SUM POP ; The PROC FORMAT in this example generates a lookup table, and the PUT function searches the table and returns the label that maps to the variable value for COUNRTY and stores the label in a new character variable REGION. The data step creates a new variable and the PROC PRINT will show the population now calculated at the region level. DATA SUB_NW ; INFILE DATA ; INPUT COUNTY POP ; IF PUT( COUNTY, REGFMT. ) = NW ; Used in this way, the PUT function performs the table lookup for subsetting purposes without creating a new variable. Character Handling Functions Both an UPCASE and LOWCASE are now available. X = 'text' ; Y = UPCASE(X) ; Z = LOWCASE (Y) ; PUT X= Y= Z= ; X = text Y = TEXT Z = text The LEFT and RIGHT functions justify the variable values accordingly. The length of the argument variable does not change. Consider the use of these functions where the value of an existing character variable is to be selection criteria for a subset. In the example below, the subset only contains observations where DRUG is equal to Placebo. Note that the data may have been keyed and stored inconsistently with respect to case. To ensure accurate selection, temporarily modify the value to compare with a constant. DATA CONTROLS ; SET OLD ; IF UPCASE(LEFT(DRUG)) = PLACEBO ; The COMPRESS function removes every occurrence of specific characters (blanks or other) in a character string. COMPBL compresses multiple blanks between words in a text string to a single blank, but not affect single blanks. STRING = 'TEXT IS A MESS' ; X = COMPRESS(STRING) ; Y = COMPBL(STRING) ; PUT X= Y= ;

5 X = TEXTISAMESS Y = TEXT IS A MESS The TRANSLATE function replaces specific characters in a string with individual characters you specify, returning an altered string. TRANWRD replaces or removes all occurrences of a word in a string. Note the syntax: TRANSLATE (source, to-1, from-1,...) replaces specific characters in a string with Individual characters that you specify TRANWRD ( source, target, replacement) replaces or removes all occurrences of a word or DATA _NULL_ ; *** write original value of variable DATA to log ; DATA = 1234,ABC,X,Y,Z ; PUT DATA= PROGRAM OUTPUT ; *** translate all commas in DATA to blanks ; *** write new value to log ; DATA = TRANSLATE(DATA,,, ) ; PUT DATA= AFTER ; *** declare original values of OLD and TEXT ; OLD = BAD ; TEXT = NO BAD NEWS ; PUT OLD= TEXT= '(BEFORE) ; *** text substitution; *** substitute new for old ; TEXT = TRANWRD (TEXT, OLD, 'NEW' ) ; PUT TEXT= '(AFTER)' ; DATA = 1234,ABC,X,Y,Z PROGRAM OUTPUT DATA = 1234 ABC X Y Z (AFTER) OLD = BAD TEXT = NO BAD NEWS (BEFORE) TEXT = NO NEW NEWS (AFTER) TRIM removes trailing blanks from a character string. TRIMN does the same thing, except TRIM returns one blank for a blank string and TRIMN returns a null string. These functions are especially useful in concatenation operations. DATA _NULL_ ; STRING1 = 'TRIMMED ' ; STRING2 = '?' ; STRING3 = '!' ; STRING4 = ' ' ; W = STRING1 STRING2 ; X = TRIM(STRING1) STRING3 ; Y = STRING2 TRIM(STRING4) STRING3 ; Z = STRING2 TRIMN(STRING4) STRING3 ; W = TRIMMED? X = TRIMMED! Y =?! Z =?! INDEX requires two arguments, the first identifies the character string to be searched, the second identifies the character string to search for in the first argument. INDEX searches argument-1 from left to right for the first occurrence of the string specified in argument-2 and returns the position of the found string s first character. If the string is not found, INDEX returns 0. The INDEXC function searches argument-1 from left to right for the first occurrence of any character present in the other arguments and returns an integer representing the position in argument-1 of the first character found. INDEXC also returns a value of 0 if none of the characters is found. string TEXT = SUGI 24, MIAMI, FL ; X = 4,M ; INDEX_X = INDEX( TEXT, X ) ; PUT INDEX_X= ; INDEXC_Y = INDEXC( TEXT, , ;()=. ) ; PUT INDEXC_Y= ; INDEX_X = 7 INDEXC_Y = 6 Numeric Functions and Sample Selection As seen before, the MOD function takes two numeric arguments and returns the remainder of argument-1 divided by argument-2. Consider the use of the MOD function in generating a random sample where the input data set is sorted by the numeric variable IDNUM and the user intends to select every 100 th patient. DATA TEST ; SET PATIENTS ; IF MOD(IDNUM, 100) = 0 ; Similarly, a random number generating function can be used for approximated sized samples. DATA TESTDATA ; SET PATIENTS ; IF UNIFORM( 0 ) <.10 ; ** approximately 10% ; Random number generating functions require a seed (see Chapter 3 of the SAS Language manual for a complete discussion of seed. The are several functions that generate numbers based on specific algorithms. UNIFORM returns a number from the uniform distribution in the interval (0, 1). A more efficient use of these types of functions in sample select involves the use of the POINT= option on the SET statement to read the input SAS data set using direct access by observation number. When the random number generated by UNIFORM is multiplied by the number of observations in the input data set (available to the SET statement at compile time), you select random observations. DATA SAMPLE ; DO J = 1 TO 10 ; PTR = (INT(UNIFORM(0) * NOBS )) + 1 ;

6 SET OLD POINT = PTR NOBS = NOBS ; SELPTR = PTR; OUTPUT ; END ; STOP ; * required to stop data step processing ; PROC PRINT NOOBS LABEL ; VAR J SELPTR ; LABEL SELPTR = Observation Number Selected ; Observation Number J Selected A = FLOOR( 2.1 ) ; ** A=2 ; B = FLOOR( 3 ) ; ** B=3 ; C = CEIL( 2.1 ) ; ** C=3 ; D = CEIL( 3 ) ; ** D=3 ; Certain manipulations may require that you know the length of particular variable for the current observation. The LENGTH function takes one argument and returns its length. DATA _NULL_; PAT = E. Pluribus Turner ; PAT2 = ; Y=LENGTH(PAT); Z=LENGTH(PAT2); PUT Y=; PUT Z=; Y=18 Z=1 Note that when the argument is missing, LENGTH returns a value of 1. More Numeric Functions The RANGE function takes at least 2 numeric arguments and returns the difference between the largest and the smallest of the nonmissing arguments: DATA _NULL_ ; A=10 ; B=27 ; C=3 ; ARRAY QUESTION Q1-Q5 ; DO J=1 to DIM(QUESTION) ; QUESTION{J} = INT(UNIFORM(50) *100) ; PUT QUESTION{J}= ; END ; X=RANGE(A, B, C) ; Y=RANGE(-1,., 1 ) ; Z=RANGE( OF Q1-Q5 ) ; PUT X= ; PUT Y= ; PUT Z= ; Q1=24 Q2=50 Q3=99 Q4=96 Q5=8 X=24 Y=2 Z=91 The FLOOR function takes one numeric argument and returns the largest integer that is less than or equal to the argument. The CEIL function returns the smallest integer that is greater than or equal to the argument. Applications with Embedded Functions (from recent SAS-L discussions) Problem 1: The variable NAME in data set A was coded in all caps. Rewrite the value such that the first character of each word is upper case and the remainder of the word is in lower case. DATA B ( KEEP = NAME NEWNAME) ; SET A ; ** contains variable NAME in all caps ** ; A1 = SCAN( NAME, 1) ; A2 = SCAN( NAME, 2) ; NEWNAME = SUBSTR(A1,1,1) LOWCASE( SUBSTR(A1, 2, LENGTH( A1 ) - 1 )) SUBSTR( A2, 1, 1 ) LOWCASE( SUBSTR( A2, 2, LENGTH( A2) - 1 )) ; PUT NAME= NEWNAME= ; NAME=RESPIRATORY SYSTEM NEWNAME=Respiratory System NAME=CARDIOVASCULAR UNIT NEWNAME=Cardiovascular Unit NAME=PEDIATRIC WING NEWNAME=Pediatric Wing Problem 2: Parse a filename dump for the date. The original solution stopped working when a numeric became part of the prefix. data new; record="scu3lly xfiles"; output; record="mul7dar xfiles"; output; record="how9ard xfiles"; output; run; data substr;

7 set new; newdate=put(input(substr(record, index(record,. )- 6,6), yymmdd6.), mmddyy8.); run; proc print noobs; run; RECORD NEWDATE scu3lly xfiles 11/01/98 mul7dar xfiles 11/02/98 how9ard xfiles 11/03/98 From the Valley of the Sun Users Group (VALSUG), Phoenix, AZ, July 1998 Newsletter: (with apologies to Andy Rooney) Why is there a DIM function and not a BRIGHTEN one? And a MEAN function and not a NICE function? The TRANSLATE function - that sounds like one I d have to use a lot. And with a FLOOR function and a CEIL function, wouldn t you think they d need a WALL function? DATE and TIME Functions The tutorial has not dealt with the many DATE and TIME functions. This group of functions is a tutorial unto itself, and I highly recommend the following presentation scheduled today: beginning tutorial presented by Andy Karp Monday at 2:30 entitled Working With SAS Date and Time Functions with Reference to Year 2000 Issues will include an impressive tutorial on DATE and TIME functions that will also touch on Y2K. Reference SAS Institute Inc. SAS Language: Reference, Version 6, First Edition, Cary, NC: SAS Institute Inc., SAS is a registered trademark of SAS Institute Inc., Cary, NC. The following publications are also excellent: Working With SAS DATE and TIME Functions by Andy Karp, published in the Proceedings of the Twenty First Annual SUGI Conference in Chicago, IL, DATE Intervals - The INTCK Function by Debbie Hoppe published in the Proceedings of the Third Annual SESUG Conference (SouthEast SAS Users Group) in Raleigh, NC, Conclusion The intent of this paper was not to illustrate the syntax and invocation of every SAS function, but to tantalize. The breadth of functionality provided in invaluable to the SAS programmer. Chances are you ve hardcoded a problem for which there exists a function solution. Give Chapter 11 a long, hard look. RECOMMENDATIONS In his book In the Know: SAS Tips and Techniques from Around the Globe, Phil Mason has an interesting chapter that deals with some of the defaults and peculiarities of some SAS functions. The behavior of functions is not always intuitive, and it pays to examine your results and test your code thoroughly. BONUS

B) Mean Function: This function returns the arithmetic mean (average) and ignores the missing value. E.G: Var=MEAN (var1, var2, var3 varn);

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.

More information

Data Cleaning and Base SAS Functions Caroline Bahler, Meridian Software Inc

Data Cleaning and Base SAS Functions Caroline Bahler, Meridian Software Inc Data Cleaning and Base SAS s Caroline Bahler, Meridian Software Inc Introduction s are small programming subroutines and can be defined as the work horses of any data cleansing operation. Dirty data, unfortunately,

More information

THE POWER OF PROC FORMAT

THE POWER OF PROC FORMAT THE POWER OF PROC FORMAT Jonas V. Bilenas, Chase Manhattan Bank, New York, NY ABSTRACT The FORMAT procedure in SAS is a very powerful and productive tool. Yet many beginning programmers rarely make use

More information

Paper 2917. Creating Variables: Traps and Pitfalls Olena Galligan, Clinops LLC, San Francisco, CA

Paper 2917. Creating Variables: Traps and Pitfalls Olena Galligan, Clinops LLC, San Francisco, CA Paper 2917 Creating Variables: Traps and Pitfalls Olena Galligan, Clinops LLC, San Francisco, CA ABSTRACT Creation of variables is one of the most common SAS programming tasks. However, sometimes it produces

More information

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 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.

More information

WORKING WITH SAS DATE AND TIME FUNCTIONS Andrew H. Karp Sierra Information Services, Inc. San Francisco, California USA

WORKING WITH SAS DATE AND TIME FUNCTIONS Andrew H. Karp Sierra Information Services, Inc. San Francisco, California USA WORKING WITH SAS DATE AND TIME FUNCTIONS Andrew H. Karp Sierra Information Services, Inc. San Francisco, California USA Introduction Many SAS applications require that operations be performed on data collected

More information

New Tricks for an Old Tool: Using Custom Formats for Data Validation and Program Efficiency

New Tricks for an Old Tool: Using Custom Formats for Data Validation and Program Efficiency New Tricks for an Old Tool: Using Custom Formats for Data Validation and Program Efficiency S. David Riba, JADE Tech, Inc., Clearwater, FL ABSTRACT PROC FORMAT is one of the old standards among SAS Procedures,

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

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

More information

Nine Steps to Get Started using SAS Macros

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

More information

PROC SQL for SQL Die-hards Jessica Bennett, Advance America, Spartanburg, SC Barbara Ross, Flexshopper LLC, Boca Raton, FL

PROC SQL for SQL Die-hards Jessica Bennett, Advance America, Spartanburg, SC Barbara Ross, Flexshopper LLC, Boca Raton, FL PharmaSUG 2015 - Paper QT06 PROC SQL for SQL Die-hards Jessica Bennett, Advance America, Spartanburg, SC Barbara Ross, Flexshopper LLC, Boca Raton, FL ABSTRACT Inspired by Christianna William s paper on

More information

Performing Queries Using PROC SQL (1)

Performing Queries Using PROC SQL (1) SAS SQL Contents Performing queries using PROC SQL Performing advanced queries using PROC SQL Combining tables horizontally using PROC SQL Combining tables vertically using PROC SQL 2 Performing Queries

More information

SQL - QUICK GUIDE. Allows users to access data in relational database management systems.

SQL - QUICK GUIDE. Allows users to access data in relational database management systems. http://www.tutorialspoint.com/sql/sql-quick-guide.htm SQL - QUICK GUIDE Copyright tutorialspoint.com What is SQL? SQL is Structured Query Language, which is a computer language for storing, manipulating

More information

Introduction to SAS Informats and Formats

Introduction to SAS Informats and Formats CHAPTER 1 Introduction to SAS Informats and Formats 1.1 Chapter Overview... 2 1.2 Using SAS Informats... 2 1.2.1 INPUT Statement... 3 1.2.2 INPUT Function... 7 1.2.3 INPUTN and INPUTC Functions... 8 1.2.4

More information

Tips to Use Character String Functions in Record Lookup

Tips to Use Character String Functions in Record Lookup BSTRCT Tips to Use Character String Functions in Record Lookup njan Matlapudi Pharmacy Informatics, PerformRx, The Next Generation PBM, 200 Stevens Drive, Philadelphia, P 19113 This paper gives you a better

More information

EXST SAS Lab Lab #4: Data input and dataset modifications

EXST SAS Lab Lab #4: Data input and dataset modifications EXST SAS Lab Lab #4: Data input and dataset modifications Objectives 1. Import an EXCEL dataset. 2. Infile an external dataset (CSV file) 3. Concatenate two datasets into one 4. The PLOT statement will

More information

SAS PROGRAM EFFICIENCY FOR BEGINNERS. Bruce Gilsen, Federal Reserve Board

SAS PROGRAM EFFICIENCY FOR BEGINNERS. Bruce Gilsen, Federal Reserve Board SAS PROGRAM EFFICIENCY FOR BEGINNERS Bruce Gilsen, Federal Reserve Board INTRODUCTION This paper presents simple efficiency techniques that can benefit inexperienced SAS software users on all platforms.

More information

Formulas & Functions in Microsoft Excel

Formulas & Functions in Microsoft Excel Formulas & Functions in Microsoft Excel Theresa A Scott, MS Biostatistician II Department of Biostatistics Vanderbilt University theresa.scott@vanderbilt.edu Table of Contents 1 Introduction 1 1.1 Using

More information

Netezza SQL Class Outline

Netezza SQL Class Outline Netezza SQL Class Outline CoffingDW education has been customized for every customer for the past 20 years. Our classes can be taught either on site or remotely via the internet. Education Contact: John

More information

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

More information

Rational Exponents. Squaring both sides of the equation yields. and to be consistent, we must have

Rational Exponents. Squaring both sides of the equation yields. and to be consistent, we must have 8.6 Rational Exponents 8.6 OBJECTIVES 1. Define rational exponents 2. Simplify expressions containing rational exponents 3. Use a calculator to estimate the value of an expression containing rational exponents

More information

Let the CAT Out of the Bag: String Concatenation in SAS 9 Joshua Horstman, Nested Loop Consulting, Indianapolis, IN

Let the CAT Out of the Bag: String Concatenation in SAS 9 Joshua Horstman, Nested Loop Consulting, Indianapolis, IN Paper S1-08-2013 Let the CAT Out of the Bag: String Concatenation in SAS 9 Joshua Horstman, Nested Loop Consulting, Indianapolis, IN ABSTRACT Are you still using TRIM, LEFT, and vertical bar operators

More information

A Technique for Storing and Manipulating Incomplete Dates in a Single SAS Date Value

A Technique for Storing and Manipulating Incomplete Dates in a Single SAS Date Value A Technique for Storing and Manipulating Incomplete Dates in a Single SAS Date Value John Ingersoll Introduction: This paper presents a technique for storing incomplete date values in a single variable

More information

Labels, Labels, and More Labels Stephanie R. Thompson, Rochester Institute of Technology, Rochester, NY

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

More information

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. 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

More information

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

More information

Microsoft Access 3: Understanding and Creating Queries

Microsoft Access 3: Understanding and Creating Queries Microsoft Access 3: Understanding and Creating Queries In Access Level 2, we learned how to perform basic data retrievals by using Search & Replace functions and Sort & Filter functions. For more complex

More information

MULTIPLICATION AND DIVISION OF REAL NUMBERS In this section we will complete the study of the four basic operations with real numbers.

MULTIPLICATION AND DIVISION OF REAL NUMBERS In this section we will complete the study of the four basic operations with real numbers. 1.4 Multiplication and (1-25) 25 In this section Multiplication of Real Numbers Division by Zero helpful hint The product of two numbers with like signs is positive, but the product of three numbers with

More information

Commonly Used Excel Functions. Supplement to Excel for Budget Analysts

Commonly Used Excel Functions. Supplement to Excel for Budget Analysts Supplement to Excel for Budget Analysts Version 1.0: February 2016 Table of Contents Introduction... 4 Formulas and Functions... 4 Math and Trigonometry Functions... 5 ABS... 5 ROUND, ROUNDUP, and ROUNDDOWN...

More information

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition

More information

How to Reduce the Disk Space Required by a SAS Data Set

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,

More information

Search and Replace in SAS Data Sets thru GUI

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

More information

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

More information

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: 9081 + 900b + 90c = 9001 + 100c + 10b

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: 9081 + 900b + 90c = 9001 + 100c + 10b In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should

More information

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code 1 Introduction The purpose of this assignment is to write an interpreter for a small subset of the Lisp programming language. The interpreter should be able to perform simple arithmetic and comparisons

More information

Descriptive statistics Statistical inference statistical inference, statistical induction and inferential statistics

Descriptive statistics Statistical inference statistical inference, statistical induction and inferential statistics Descriptive statistics is the discipline of quantitatively describing the main features of a collection of data. Descriptive statistics are distinguished from inferential statistics (or inductive statistics),

More information

Quick Start to Data Analysis with SAS Table of Contents. Chapter 1 Introduction 1. Chapter 2 SAS Programming Concepts 7

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

More information

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

More information

Advanced Tutorials. Numeric Data In SAS : Guidelines for Storage and Display Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD

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

More information

Handling Missing Values in the SQL Procedure

Handling Missing Values in the SQL Procedure Handling Missing Values in the SQL Procedure Danbo Yi, Abt Associates Inc., Cambridge, MA Lei Zhang, Domain Solutions Corp., Cambridge, MA ABSTRACT PROC SQL as a powerful database management tool provides

More information

6.170 Tutorial 3 - Ruby Basics

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

More information

Chapter 3. Input and output. 3.1 The System class

Chapter 3. Input and output. 3.1 The System class Chapter 3 Input and output The programs we ve looked at so far just display messages, which doesn t involve a lot of real computation. This chapter will show you how to read input from the keyboard, use

More information

3 Some Integer Functions

3 Some Integer Functions 3 Some Integer Functions A Pair of Fundamental Integer Functions The integer function that is the heart of this section is the modulo function. However, before getting to it, let us look at some very simple

More information

Introduction to Character String Functions

Introduction to Character String Functions Introduction to Character String Functions Jason Ford, Bureau of Labor Statistics ABSTRACT Character string functions allow a user to manipulate character variables in a variety of ways. Users can create

More information

Math Workshop October 2010 Fractions and Repeating Decimals

Math Workshop October 2010 Fractions and Repeating Decimals Math Workshop October 2010 Fractions and Repeating Decimals This evening we will investigate the patterns that arise when converting fractions to decimals. As an example of what we will be looking at,

More information

The SAS Data step/macro Interface

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

More information

SOME EXCEL FORMULAS AND FUNCTIONS

SOME EXCEL FORMULAS AND FUNCTIONS SOME EXCEL FORMULAS AND FUNCTIONS About calculation operators Operators specify the type of calculation that you want to perform on the elements of a formula. Microsoft Excel includes four different types

More information

Pseudo code Tutorial and Exercises Teacher s Version

Pseudo code Tutorial and Exercises Teacher s Version Pseudo code Tutorial and Exercises Teacher s Version Pseudo-code is an informal way to express the design of a computer program or an algorithm in 1.45. The aim is to get the idea quickly and also easy

More information

PO-18 Array, Hurray, Array; Consolidate or Expand Your Input Data Stream Using Arrays

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

More information

Microsoft Excel 2010 Part 3: Advanced Excel

Microsoft Excel 2010 Part 3: Advanced Excel CALIFORNIA STATE UNIVERSITY, LOS ANGELES INFORMATION TECHNOLOGY SERVICES Microsoft Excel 2010 Part 3: Advanced Excel Winter 2015, Version 1.0 Table of Contents Introduction...2 Sorting Data...2 Sorting

More information

CHAPTER 5 Round-off errors

CHAPTER 5 Round-off errors CHAPTER 5 Round-off errors In the two previous chapters we have seen how numbers can be represented in the binary numeral system and how this is the basis for representing numbers in computers. Since any

More information

Excel: Introduction to Formulas

Excel: Introduction to Formulas Excel: Introduction to Formulas Table of Contents Formulas Arithmetic & Comparison Operators... 2 Text Concatenation... 2 Operator Precedence... 2 UPPER, LOWER, PROPER and TRIM... 3 & (Ampersand)... 4

More information

Useful Microsoft Excel Functions & Formulas Theresa A Scott, MS Department of Biostatistics Vanderbilt University theresa.scott@vanderbilt.

Useful Microsoft Excel Functions & Formulas Theresa A Scott, MS Department of Biostatistics Vanderbilt University theresa.scott@vanderbilt. Useful Microsoft Excel Functions & s Theresa Scott, MS Department of Biostatistics Vanderbilt University theresa.scott@vanderbilt.edu This document contains a series of examples that illustrate some useful

More information

Informatica e Sistemi in Tempo Reale

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)

More information

Section 4.1 Rules of Exponents

Section 4.1 Rules of Exponents Section 4.1 Rules of Exponents THE MEANING OF THE EXPONENT The exponent is an abbreviation for repeated multiplication. The repeated number is called a factor. x n means n factors of x. The exponent tells

More information

Multiplying and Dividing Signed Numbers. Finding the Product of Two Signed Numbers. (a) (3)( 4) ( 4) ( 4) ( 4) 12 (b) (4)( 5) ( 5) ( 5) ( 5) ( 5) 20

Multiplying and Dividing Signed Numbers. Finding the Product of Two Signed Numbers. (a) (3)( 4) ( 4) ( 4) ( 4) 12 (b) (4)( 5) ( 5) ( 5) ( 5) ( 5) 20 SECTION.4 Multiplying and Dividing Signed Numbers.4 OBJECTIVES 1. Multiply signed numbers 2. Use the commutative property of multiplication 3. Use the associative property of multiplication 4. Divide signed

More information

Q&As: Microsoft Excel 2013: Chapter 2

Q&As: Microsoft Excel 2013: Chapter 2 Q&As: Microsoft Excel 2013: Chapter 2 In Step 5, why did the date that was entered change from 4/5/10 to 4/5/2010? When Excel recognizes that you entered a date in mm/dd/yy format, it automatically formats

More information

Lecture 22: C Programming 4 Embedded Systems

Lecture 22: C Programming 4 Embedded Systems Lecture 22: C Programming 4 Embedded Systems Today s Goals Basic C programming process Variables and constants in C Pointers to access addresses Using a High Level Language High-level languages More human

More information

Ten Things You Should Know About PROC FORMAT Jack Shoemaker, Accordant Health Services, Greensboro, NC

Ten Things You Should Know About PROC FORMAT Jack Shoemaker, Accordant Health Services, Greensboro, NC Ten Things You Should Know About PROC FORMAT Jack Shoemaker, Accordant Health Services, Greensboro, NC ABSTRACT The SAS system shares many features with other programming languages and reporting packages.

More information

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test Math Review for the Quantitative Reasoning Measure of the GRE revised General Test www.ets.org Overview This Math Review will familiarize you with the mathematical skills and concepts that are important

More information

MATH-0910 Review Concepts (Haugen)

MATH-0910 Review Concepts (Haugen) Unit 1 Whole Numbers and Fractions MATH-0910 Review Concepts (Haugen) Exam 1 Sections 1.5, 1.6, 1.7, 1.8, 2.1, 2.2, 2.3, 2.4, and 2.5 Dividing Whole Numbers Equivalent ways of expressing division: a b,

More information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012 Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

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

More information

Advanced Tutorials. The Dark Side of the Transparent Moon

Advanced Tutorials. The Dark Side of the Transparent Moon The Dark Side of the Transparent Moon -- Tips, Tricks and Traps of Handling ORACLE Data Using SAS Xinyu Ji, Fallon Clinic, Worcester, MA ABSTRACT The paper discusses tips, tricks and traps of handling

More information

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. 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

More information

Efficient Techniques and Tips in Handling Large Datasets Shilong Kuang, Kelley Blue Book Inc., Irvine, CA

Efficient Techniques and Tips in Handling Large Datasets Shilong Kuang, Kelley Blue Book Inc., Irvine, CA Efficient Techniques and Tips in Handling Large Datasets Shilong Kuang, Kelley Blue Book Inc., Irvine, CA ABSTRACT When we work on millions of records, with hundreds of variables, it is crucial how we

More information

Innovative Techniques and Tools to Detect Data Quality Problems

Innovative Techniques and Tools to Detect Data Quality Problems Paper DM05 Innovative Techniques and Tools to Detect Data Quality Problems Hong Qi and Allan Glaser Merck & Co., Inc., Upper Gwynnedd, PA ABSTRACT High quality data are essential for accurate and meaningful

More information

Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

More information

The Power of CALL SYMPUT DATA Step Interface by Examples Yunchao (Susan) Tian, Social & Scientific Systems, Inc., Silver Spring, MD

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

More information

The Deadly Sins of Algebra

The Deadly Sins of Algebra The Deadly Sins of Algebra There are some algebraic misconceptions that are so damaging to your quantitative and formal reasoning ability, you might as well be said not to have any such reasoning ability.

More information

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10 Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

More information

1.6 The Order of Operations

1.6 The Order of Operations 1.6 The Order of Operations Contents: Operations Grouping Symbols The Order of Operations Exponents and Negative Numbers Negative Square Roots Square Root of a Negative Number Order of Operations and Negative

More information

Chapter 7: Additional Topics

Chapter 7: Additional Topics Chapter 7: Additional Topics In this chapter we ll briefly cover selected advanced topics in fortran programming. All the topics come in handy to add extra functionality to programs, but the feature you

More information

Programming Idioms Using the SET Statement

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

More information

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. 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

More information

Creating External Files Using SAS Software

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

More information

PREPARATION FOR MATH TESTING at CityLab Academy

PREPARATION FOR MATH TESTING at CityLab Academy PREPARATION FOR MATH TESTING at CityLab Academy compiled by Gloria Vachino, M.S. Refresh your math skills with a MATH REVIEW and find out if you are ready for the math entrance test by taking a PRE-TEST

More information

CALCULATIONS & STATISTICS

CALCULATIONS & STATISTICS CALCULATIONS & STATISTICS CALCULATION OF SCORES Conversion of 1-5 scale to 0-100 scores When you look at your report, you will notice that the scores are reported on a 0-100 scale, even though respondents

More information

USING PROCEDURES TO CREATE SAS DATA SETS... ILLUSTRATED WITH AGE ADJUSTING OF DEATH RATES 1

USING PROCEDURES TO CREATE SAS DATA SETS... ILLUSTRATED WITH AGE ADJUSTING OF DEATH RATES 1 USING PROCEDURES TO CREATE SAS DATA SETS... ILLUSTRATED WITH AGE ADJUSTING OF DEATH RATES 1 There may be times when you run a SAS procedure when you would like to direct the procedure output to a SAS data

More information

SAS: A Mini-Manual for ECO 351 by Andrew C. Brod

SAS: A Mini-Manual for ECO 351 by Andrew C. Brod SAS: A Mini-Manual for ECO 351 by Andrew C. Brod 1. Introduction This document discusses the basics of using SAS to do problems and prepare for the exams in ECO 351. I decided to produce this little guide

More information

Introduction to Python

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

More information

What You re Missing About Missing Values

What You re Missing About Missing Values Paper 1440-2014 What You re Missing About Missing Values Christopher J. Bost, MDRC, New York, NY ABSTRACT Do you know everything you need to know about missing values? Do you know how to assign a missing

More information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

Numbering Systems. InThisAppendix...

Numbering Systems. InThisAppendix... G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal

More information

Means, standard deviations and. and standard errors

Means, standard deviations and. and standard errors CHAPTER 4 Means, standard deviations and standard errors 4.1 Introduction Change of units 4.2 Mean, median and mode Coefficient of variation 4.3 Measures of variation 4.4 Calculating the mean and standard

More information

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved.

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved. 1 6 JavaScript: Introduction to Scripting 2 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask,

More information

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook. Elementary Number Theory and Methods of Proof CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 1 Number theory Properties: 2 Properties of integers (whole

More information

EXTRACTING DATA FROM PDF FILES

EXTRACTING DATA FROM PDF FILES Paper SER10_05 EXTRACTING DATA FROM PDF FILES Nat Wooding, Dominion Virginia Power, Richmond, Virginia ABSTRACT The Adobe Portable Document File (PDF) format has become a popular means of producing documents

More information

Programming with SQL

Programming with SQL Unit 43: Programming with SQL Learning Outcomes A candidate following a programme of learning leading to this unit will be able to: Create queries to retrieve information from relational databases using

More information

grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print

grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print In the simplest terms, grep (global regular expression print) will search input

More information

Reading Delimited Text Files into SAS 9 TS-673

Reading Delimited Text Files into SAS 9 TS-673 Reading Delimited Text Files into SAS 9 TS-673 Reading Delimited Text Files into SAS 9 i Reading Delimited Text Files into SAS 9 Table of Contents Introduction... 1 Options Available for Reading Delimited

More information

PharmaSUG 2015 - Paper QT26

PharmaSUG 2015 - Paper QT26 PharmaSUG 2015 - Paper QT26 Keyboard Macros - The most magical tool you may have never heard of - You will never program the same again (It's that amazing!) Steven Black, Agility-Clinical Inc., Carlsbad,

More information

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering Engineering Problem Solving and Excel EGN 1006 Introduction to Engineering Mathematical Solution Procedures Commonly Used in Engineering Analysis Data Analysis Techniques (Statistics) Curve Fitting techniques

More information

Base Conversion written by Cathy Saxton

Base Conversion written by Cathy Saxton Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,

More information

Anyone Can Learn PROC TABULATE

Anyone Can Learn PROC TABULATE Paper 60-27 Anyone Can Learn PROC TABULATE Lauren Haworth, Genentech, Inc., South San Francisco, CA ABSTRACT SAS Software provides hundreds of ways you can analyze your data. You can use the DATA step

More information

Exercise 4 Learning Python language fundamentals

Exercise 4 Learning Python language fundamentals Exercise 4 Learning Python language fundamentals Work with numbers Python can be used as a powerful calculator. Practicing math calculations in Python will help you not only perform these tasks, but also

More information

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, 2008. 1 Introduction 1. 2 Invoking Shell Scripts 2

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......................................

More information

Trade Flows and Trade Policy Analysis. October 2013 Dhaka, Bangladesh

Trade Flows and Trade Policy Analysis. October 2013 Dhaka, Bangladesh Trade Flows and Trade Policy Analysis October 2013 Dhaka, Bangladesh Witada Anukoonwattaka (ESCAP) Cosimo Beverelli (WTO) 1 Introduction to STATA 2 Content a. Datasets used in Introduction to Stata b.

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

More information

Oracle Database: SQL and PL/SQL Fundamentals

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

More information