1 Learning SAS by Example A Programmer s Guide Ron Cody SAS Press
2 From Learning SAS by Example. Full book available for purchase here. Contents List of Programs xv Preface xxix Acknowledgments xxxi Part 1 Getting Started 1 Chapter 1 What Is SAS? Introduction Getting Data into SAS A Sample SAS Program SAS Names SAS Data Sets and SAS Data Types The SAS Display Manager and SAS Enterprise Guide Problems 9 Chapter 2 Writing Your First SAS Program A Simple Program to Read Raw Data and Produce a Report Enhancing the Program More on Comment Statements How SAS Works (a Look Inside the Black Box ) Problems 25 Part 2 DATA Step Processing 27 Chapter 3 Reading Raw Data from External Files Introduction Reading Data Values Separated by Blanks Specifying Missing Values with List Input Reading Data Values Separated by Commas (CSV Files) Using an Alternative Method to Specify an External File 34
3 iv Contents 3.6 Reading Data Values Separated by Delimiters Other Than Blanks or Commas Placing Data Lines Directly in Your Program (the DATALINES Statement) Specifying INFILE Options with the DATALINES Statement Reading Raw Data from Fixed Columns Method 1: Column Input Reading Raw Data from Fixed Columns Method 2: Formatted Input Using a FORMAT Statement in a DATA Step versus in a Procedure Using Informats with List Input Supplying an INFORMAT Statement with List Input Using List Input with Embedded Delimiters Problems 47 Chapter 4 Creating Permanent SAS Data Sets Introduction SAS Libraries The LIBNAME Statement Why Create Permanent SAS Data Sets? Examining the Descriptor Portion of a SAS Data Set Using PROC CONTENTS Listing All the SAS Data Sets in a SAS Library Using PROC CONTENTS Viewing the Descriptor Portion of a SAS Data Set Using the SAS Explorer Viewing the Data Portion of a SAS Data Set Using PROC PRINT Viewing the Data Portion of a SAS Data Set Using the SAS VIEWTABLE Window Using a SAS Data Set as Input to a DATA Step DATA _NULL_: A Data Set That Isn t Problems 68
4 Contents v Chapter 5 Creating Formats and Labels Adding Labels to Your Variables Using Formats to Enhance Your Output Regrouping Values Using Formats More on Format Ranges Storing Your Formats in a Format Library Permanent Data Set Attributes Accessing a Permanent SAS Data Set with User-Defined Formats Displaying Your Format Definitions Problems 84 Chapter 6 Reading and Writing Data from an Excel Spreadsheet Introduction Using the Import Wizard to Convert a Spreadsheet to a SAS Data Set Creating an Excel Spreadsheet from a SAS Data Set Using an Engine to Read an Excel Spreadsheet Using the SAS Output Delivery System to Convert a SAS Data Set to an Excel Spreadsheet Problems 98 Chapter 7 Performing Conditional Processing Introduction The IF and ELSE IF Statements The Subsetting IF Statement The IN Operator Using a SELECT Statement for Logical Tests Using Boolean Logic (AND, OR, and NOT Operators) A Caution When Using Multiple OR Operators The WHERE Statement Some Useful WHERE Operators Problems 114
5 vi Contents Chapter 8 Performing Iterative Processing: Looping Introduction DO Groups The Sum Statement The Iterative DO Loop Other Forms of an Iterative DO Loop DO WHILE and DO UNTIL Statements A Caution When Using DO UNTIL Statements LEAVE and CONTINUE Statements Problems 137 Chapter 9 Working with Dates Introduction How SAS Stores Dates Reading Date Values from Raw Data Computing the Number of Years between Two Dates Demonstrating a Date Constant Computing the Current Date Extracting the Day of the Week, Day of the Month, Month, and Year from a SAS Date Creating a SAS Date from Month, Day, and Year Values Substituting the 15th of the Month when the Day Value Is Missing Using Date Interval Functions Problems 157 Chapter 10 Subsetting and Combining SAS Data Sets Introduction Subsetting a SAS Data Set Creating More Than One Subset Data Set in One DATA Step Adding Observations to a SAS Data Set Interleaving Data Sets Combining Detail and Summary Data 168
6 Contents vii 10.7 Merging Two Data Sets Omitting the BY Statement in a Merge Controlling Observations in a Merged Data Set More Uses for IN= Variables When Does a DATA Step End? Merging Two Data Sets with Different BY Variable Names Merging Two Data Sets with Different BY Variable Data Types One-to-One, One-to-Many, and Many-to-Many Merges Updating a Master File from a Transaction File Problems 185 Chapter 11 Working with Numeric Functions Introduction Functions That Round and Truncate Numeric Values Functions That Work with Missing Values Setting Character and Numeric Values to Missing Descriptive Statistics Functions Computing Sums within an Observation Mathematical Functions Computing Some Useful Constants Generating Random Numbers Special Functions Functions That Return Values from Previous Observations Problems 207 Chapter 12 Working with Character Functions Introduction Determining the Length of a Character Value Changing the Case of Characters Removing Characters from Strings Joining Two or More Strings Together Removing Leading or Trailing Blanks 217
7 viii Contents 12.7 Using the COMPRESS Function to Remove Characters from a String Searching for Characters Searching for Individual Characters Searching for Words in a String Searching for Character Classes Using the NOT Functions for Data Cleaning Describing a Real Blockbuster Data Cleaning Function Extracting Part of a String Dividing Strings into Words Comparing Strings Performing a Fuzzy Match Substituting Characters or Words Problems 238 Chapter 13 Working with Arrays Introduction Setting Values of 999 to a SAS Missing Value for Several Numeric Variables Setting Values of NA and? to a Missing Character Value Converting All Character Values to Lowercase Using an Array to Create New Variables Changing the Array Bounds Temporary Arrays Loading the Initial Values of a Temporary Array from a Raw Data File Using a Multidimensional Array for Table Lookup Problems 257
8 Contents ix Part 3 Presenting and Summarizing Your Data 259 Chapter 14 Displaying Your Data Introduction The Basics Changing the Appearance of Your Listing Changing the Appearance of Values Controlling the Observations That Appear in Your Listing Adding Additional Titles and Footnotes to Your Listing Changing the Order of Your Listing Sorting by More Than One Variable Labeling Your Column Headings Adding Subtotals and Totals to Your Listing Making Your Listing Easier to Read Adding the Number of Observations to Your Listing Double-Spacing Your Listing Listing the First n Observations of Your Data Set Problems 283 Chapter 15 Creating Customized Reports Introduction Using PROC REPORT Selecting Variables to Include in Your Report Comparing Detail and Summary Reports Producing a Summary Report Demonstrating the FLOW Option of PROC REPORT Using Two Grouping Variables Changing the Order of Variables in the COLUMN Statement Changing the Order of Rows in a Report Applying the ORDER Usage to Two Variables Creating a Multi-Column Report Producing Report Breaks Using a Nonprinting Variable to Order a Report Computing a New Variable with PROC REPORT Computing a Character Variable in a COMPUTE Block 308
9 x Contents Creating an ACROSS Variable with PROC REPORT Modifying the Column Label for an ACROSS Variable Using an ACROSS Usage to Display Statistics Problems 313 Chapter 16 Summarizing Your Data Introduction PROC MEANS Starting from the Beginning Adding a BY Statement to PROC MEANS Using a CLASS Statement with PROC MEANS Applying a Format to a CLASS Variable Deciding between a BY Statement and a CLASS Statement Creating Summary Data Sets Using PROC MEANS Outputting Other Descriptive Statistics with PROC MEANS Asking SAS to Name the Variables in the Output Data Set Outputting a Summary Data Set: Including a BY Statement Outputting a Summary Data Set: Including a CLASS Statement Using Two CLASS Variables with PROC MEANS Selecting Different Statistics for Each Variable Problems 338 Chapter 17 Counting Frequencies Introduction Counting Frequencies Selecting Variables for PROC FREQ Using Formats to Label the Output Using Formats to Group Values Problems Grouping Values with PROC FREQ Displaying Missing Values in the Frequency Table Changing the Order of Values in PROC FREQ Producing Two-Way Tables 356
10 Contents xi Requesting Multiple Two-Way Tables Producing Three-Way Tables Problems 360 Chapter 18 Creating Tabular Reports Introduction A Simple PROC TABULATE Table Describing the Three PROC TABULATE Operators Using the Keyword ALL Producing Descriptive Statistics Combining CLASS and Analysis Variables in a Table Customizing Your Table Demonstrating a More Complex Table Computing Row and Column Percentages Displaying Percentages in a Two-Dimensional Table Computing Column Percentages Computing Percentages on Numeric Variables Understanding How Missing Values Affect PROC TABULATE Output Problems 390 Chapter 19 Introducing the Output Delivery System Introduction Sending SAS Output to an HTML File Creating a Table of Contents Selecting a Different HTML Style Choosing Other ODS Destinations Selecting or Excluding Portions of SAS Output Sending Output to a SAS Data Set Problems 409 Chapter 20 Generating High-Quality Graphics Introduction Some Basic Concepts Producing Simple Bar Charts Using PROC GCHART Creating Pie Charts Creating Bar Charts for a Continuous Variable 416
11 xii Contents 20.6 Creating Charts with Values Representing Categories Creating Bar Charts Representing Sums Creating Bar Charts Representing Means Adding Another Variable to the Chart Producing Scatter Plots Connecting Points Connecting Points with a Smooth Line Problems 431 Part 4 Advanced Topics 435 Chapter 21 Using Advanced INPUT Techniques Introduction Handling Missing Values at the End of a Line Reading Short Data Lines Reading External Files with Lines Longer Than 256 Characters Detecting the End of the File Reading a Portion of a Raw Data File Reading Data from Multiple Files Reading Data from Multiple Files Using a FILENAME Statement Reading External Filenames from a Data File Reading Multiple Lines of Data to Form One Observation Reading Data Conditionally (the Single Sign) More Examples of the Single Sign Creating Multiple Observations from One Line of Input Using Variable and Informat Lists Using Relative Column Pointers to Read a Complex Data Structure Efficiently Problems 458
12 Contents xiii Chapter 22 Using Advanced Features of User-Defined Formats and Informats Introduction Using Formats to Recode Variables Using Formats with a PUT Function to Create New Variables Creating User-Defined Informats Reading Character and Numeric Data in One Step Using Formats (and Informats) to Perform Table Lookup Using a SAS Data Set to Create a Format Updating and Maintaining Your Formats Using Formats within Formats Using Multilabel Formats Using the INPUTN Function to Perform a More Complicated Table Lookup Problems 490 Chapter 23 Restructuring SAS Data Sets Introduction Converting a Data Set with One Observation per Subject to a Data Set with Several Observations per Subject: Using a DATA Step Converting a Data Set with Several Observations per Subject to a Data Set with One Observation per Subject: Using a DATA Step Converting a Data Set with One Observation per Subject to a Data Set with Several Observations per Subject: Using PROC TRANSPOSE Converting a Data Set with Several Observations per Subject to a Data Set with One Observation per Subject: Using PROC TRANSPOSE Problems 501 Chapter 24 Working with Multiple Observations per Subject Introduction Identifying the First or Last Observation in a Group Counting the Number of Visits Using PROC FREQ 509
13 xiv Contents 24.4 Counting the Number of Visits Using PROC MEANS Computing Differences between Observations Computing Differences between the First and Last Observation in a BY Group Using the LAG Function Computing Differences between the First and Last Observation in a BY Group Using a RETAIN Statement Using a Retained Variable to Remember a Previous Value Problems 518 Chapter 25 Introducing the SAS Macro Language Introduction Macro Variables: What Are They? Some Built-In Macro Variables Assigning Values to Macro Variables with a %LET Statement Demonstrating a Simple Macro A Word about Tokens Another Example of Using a Macro Variable as a Prefix Using a Macro Variable to Transfer a Value between DATA Steps Problems 532 Chapter 26 Introducing the Structured Query Language Introduction Some Basics Joining Two Tables (Merge) Left, Right, and Full Joins Concatenating Data Sets Using Summary Functions Demonstrating an ORDER Clause An Example of Fuzzy Matching Problems 553 Solutions to Odd-Numbered Problems 557 Index 601 From Learning SAS by Example: A Programmer's Guide. by Ron Cody. Copyright 2007, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
14 From Learning SAS by Example. Full book available for purchase here. Chapter 1 What Is SAS? 1.1 Introduction Getting Data into SAS A Sample SAS Program SAS Names SAS Data Sets and SAS Data Types The SAS Display Manager and SAS Enterprise Guide Problems Introduction SAS is a collection of modules that are used to process and analyze data. It began in the late 60s and early 70s as a statistical package (the name SAS originally stood for Statistical Analysis System). However, unlike many competing statistical packages, SAS is also an extremely powerful, general-purpose programming language. We see SAS as the predominant software in the pharmaceutical industry and most Fortune 500
15 4 Learning SAS by Example: A Programmer s Guide companies. In recent years, it has been enhanced to provide state-of-the-art data mining tools and programs for Web development and analysis. This book covers most of the basic data management and programming tools provided in Base SAS. Statistical procedures are not covered here. 1 The only way to really learn a programming language is to write lots of programs, make some errors, correct the errors, and then make some more. You can download all the programs and data files used in this book from this book s companion Web site at and from the CD that accompanies this book. If you already have access to SAS at work or school, you are ready to go. If you are learning SAS on your own and do not have a copy of SAS to play with, we highly recommend that you obtain the SAS Learning Edition 4.1. This is a relatively inexpensive, fully functional version of SAS that was developed primarily for students for learning purposes only. Anyone can buy it, either through SAS Publishing, Amazon.com, or other retailers. With a pre-set die date of 12/31/08, you can use the SAS Enterprise Guide 4.1 point-and-click interface, or write and modify SAS code using the SAS Program Editor. You will be able to run any program in this book using the SAS Learning Edition it is an ideal way to learn SAS. 1.2 Getting Data into SAS SAS can read data from almost any source. Common sources of data are raw text files, Microsoft Office Excel spreadsheets, Access databases, and most of the common database systems such as DB2 and Oracle. Most of this book uses either text files or Excel spreadsheets as data sources. 1.3 A Sample SAS Program Let s start out with a simple SAS program that reads data from a text file and produces some basic reports to give you an overview of the structure of SAS programs. 1 See Ron Cody and Jeffrey K. Smith, Applied Statistics and the Programming Language, 5th ed. (Englewood Cliffs, NJ: Prentice Hall, 2005), which is available from SAS Press, for details on using SAS for statistical analysis.
16 Chapter 1: What Is SAS? 5 For this example, we have a text file with data on vegetable seeds. Each line of the file contains the following pieces of information (separated by spaces): Vegetable name Product code Days to germination Number of seeds Price In SAS terminology, each piece of information is called a variable. (Other database systems, and sometimes SAS, use the term column.) A few sample lines from the file are shown here: File c:\books\learning\veggies.txt Cucumber A Cucumber A Carrot A Carrot A Corn A Corn A Corn A Eggplant A In this example, each line of data produces what SAS calls an observation (also referred to as a row in other systems). A complete SAS program to read this data file and produce a list of the data, a frequency count showing the number of entries for each vegetable, the average price per seed, and the average number of days until germination is shown here: Program 1-1 A sample SAS program *SAS Program to read veggie data file and to produce several reports; options nocenter nonumber; data veg; infile "c:\books\learning\veggies.txt"; input Name $ Code $ Days Number Price; CostPerSeed = Price / Number; run;
17 6 Learning SAS by Example: A Programmer s Guide title "List of the Raw Data"; proc print data=veg; run; title "Frequency Distribution of Vegetable Names"; proc freq data=veg; tables Name; run; title "Average Cost of Seeds"; proc means data=veg; var Price Days; run; At this point in the book, we won t explain every line of the program we ll just give an overview. SAS programs often contain DATA steps and PROC steps. DATA steps are parts of the program where you can read or write the data, manipulate the data, and perform calculations. PROC (short for procedure) steps are parts of your program where you ask SAS to run one or more of its procedures to produce reports, summarize the data, generate graphs, and much more. DATA steps begin with the word DATA and PROC steps begin with the word PROC. Most DATA and PROC steps end with a RUN statement (more on this later). SAS processes each DATA or PROC step completely and then goes on to the next step. SAS also contains global statements that affect the entire SAS environment and remain in effect from one DATA or PROC step to another. In the program above, the OPTIONS and TITLE statements are examples of global statements. It is important to keep in mind that the actions of global statements remain in effect until they are changed by another global statement or until you end your SAS session. All SAS programs, whether part of DATA or PROC steps, are made up of statements. Here is the rule: all SAS statements end with semicolons. This is an important rule because if you leave out a semicolon where one is needed, the program may not run correctly, resulting in hard-to-interpret error messages.
18 Chapter 1: What Is SAS? 7 Let s discuss some of the basic rules of SAS statements. First, they can begin in any column and can span several lines, if necessary. Because a semicolon determines the end of a SAS statement, you can place more than one statement on a single line (although this is not recommended as a matter of style). To help make this clear, let s look at some of the statements in Program 1-1. You could write the DATA step as shown in Program 1-2. Although this program is identical to the original, notice that it doesn t look organized, making it hard to read. Notice, too, that spacing is not critical either, though it is useful for legibility. It is a common practice to start each SAS statement on a new line and to indent each statement within a DATA or PROC step by several spaces (this author likes three spaces). Program 1-2 An alternative version of Program 1-1 data veg; infile "c:\books\learning\veggies.txt"; input Name $ Code $ Days Number Price; CostPerSeed = Price / Number; run; Another thing to notice about this program is that SAS is not case sensitive. Well, this is almost true. Of course references to external files must match the rules of your particular operating system. So, if you are running SAS under UNIX or Linux, file names will be case-sensitive. As you will see later, you get to name the variables in a SAS data set. The variable names in Program 1-1 are Name, Code, Days, Number, Price, and CostPerSeed. Although SAS doesn t care whether you write these names in uppercase, lowercase, or mixed case, it does remember the case of each variable the first time it encounters that variable and uses that form of the variable name when producing printed reports. 1.4 SAS Names SAS names follow a simple naming rule: All SAS variable names and data set names can be no longer than 32 characters and must begin with a letter or the underscore ( _ ) character. The remaining characters in the name may be letters, digits, or the underscore character. Characters such as dashes and spaces are not allowed. Here are some valid and invalid SAS names.
19 8 Learning SAS by Example: A Programmer s Guide Valid SAS Names Parts LastName First_Name Ques5 Cost_per_Pound DATE time X12Y34Z56 Invalid SAS Names 8_is_enough Begins with a number Price per Pound Contains blanks Month-total Contains an invalid character ( - ) Num% Contains an invalid character (%) 1.5 SAS Data Sets and SAS Data Types We will talk a lot about SAS data sets throughout this book. For now, you need to know that when SAS reads data from anywhere (for example, raw data, spreadsheets), it stores the data in its own special form called a SAS data set. Only SAS can read and write SAS data sets. If you opened a SAS data set with another program (Microsoft Word, for example), it would not be a pretty sight it would consist of some recognizable characters and many funny-looking graphics characters. In other words, it would look like nonsense. Even if SAS is reading data from Oracle tables or DB2, it is actually converting the data into SAS data set format in the background. The good news is that you don t ever have to worry about how SAS is storing its data or the structure of a SAS data set. However, it is important to understand that SAS data sets contain two parts: a descriptor portion and a data portion. Not only does SAS store the actual data values for you, it stores information about these values (things like storage lengths, labels, and formats). We ll discuss that more later. SAS has only two types of variables: character and numeric. This makes it much simpler to use and understand than some other programs that have many more data types (for example, integer, long integer, and logical). SAS determines a fixed storage length for every variable. Most SAS users never need to think about storage lengths for numerical
20 Chapter 1: What Is SAS? 9 values they are stored in 8 bytes (about 14 or 15 significant digits, depending on your operating system) if you don t specify otherwise. The majority of SAS users will never have to change this default value (it can lead to complications and should only be considered by experienced SAS programmers). Each character value (data stored as letters, special characters, and numerals) is assigned a fixed storage length explicitly by program statements or by various rules that SAS has about the length of character values. 1.6 The SAS Display Manager and SAS Enterprise Guide Because SAS runs on many different platforms (mainframes, microcomputers running various Microsoft operating systems, UNIX, and Linux), the way you write and run programs will vary. You might use a general-purpose text editor on a mainframe to write a SAS program, submit it, and send the output back to a terminal or to a file. On PCs, you might use the SAS Display Manager, where you write your program in the Enhanced Editor (Editor window), see any error messages and comments about your program and the data in the Log window, and view your output in the Output window. In addition to the Enhanced Editor, an older program, simply called the Program Editor, is available for Windows and UNIX users. As an alternative to the Display Manager, you may enter the SAS environment using SAS Enterprise Guide, which is a front-end to SAS that allows you to use a menu-driven system to write SAS programs and produce reports. There are many excellent books published by SAS that offer detailed instructions on how to run SAS programs on each specific platform and the appropriate access method into SAS. This book concentrates on how to write SAS programs. You will find that SAS programs, regardless of what computer or operating system you are using, look basically the same. Typically, the only changes you need to make to migrate a SAS program from one platform to another is the way you describe external data sources and where you store SAS programs and output. 1.7 Problems Solutions to odd-numbered problems are located at the back of this book and on the CD that accompanies this book. Solutions to all problems are available to professors. If you are a professor, visit the book s companion Web site at for information about how to obtain the solutions to all problems.
21 10 Learning SAS by Example: A Programmer s Guide 1. Identify which of the following variable names are valid SAS names: Height HeightInCentimeters Height_in_centimeters Wt-Kg x123y456 76Trombones MiXeDCasE 2. In the following list, classify each data set name as valid or invalid: Clinic clinic work hyphens-in-the-name 123GO Demographics_ You have a data set consisting of Student ID, English, History, Math, and Science test scores on 10 students. a. The number of variables is b. The number of observations is 4. True or false: a. You can place more than one SAS statement on a single line. b. You can use several lines for a single SAS statement. c. SAS has three data types: character, numeric, and integer. d. OPTIONS and TITLE statements are considered global statements. 5. What is the default storage length for SAS numeric variables (in bytes)? From Learning SAS by Example. Full book available for purchase here. From Learning SAS by Example: A Programmer's Guide. by Ron Cody. Copyright 2007, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
22 Index A ABS function absolute column pointer ACROSS option, DEFINE statement (REPORT) creating ACROSS variable 310 displaying statistics modifying column label 311 addition in assignment statements addresses, standardizing AFTER option, RBREAK statement (REPORT) 303 alignment parameter 156 _ALL_ keyword 59, 369, ampersand (&) 46 ANALYSIS option, DEFINE statement (REPORT) , 312 analysis variables DEFINE statement (REPORT) , 312 TABULATE procedure and , AND operator ANOVA procedure 463 ANY functions ANYALNUM function 225 ANYALPHA function 225 ANYDIGIT function 225 ANYPUNCT function 225 ANYSPACE function 225 APPEND procedure 478 arithmetic operators array reference 245 ARRAY statement asterisk (*) in changing array bounds converting character values to lowercase creating variables missing character values in missing numeric values in table lookups temporary arrays arrays CALL routines and 246 changing bounds converting character values to lowercase creating variables defined 244 loading initial values from raw data 253 missing character values in missing numeric values in multidimensional table lookup and temporary ASCII coding method 35, 230 assignment statements 19 20, 23 defined 19 RETAIN statement and 473 asterisk (*) as wildcard 338, 446, 538 associating formats 374 in ARRAY statement in assignment statements 19 in comment statements 19 TABLE statement (TABULATE) and 368 two-way tables and 356 at sign absolute column pointer column pointers and 40 double trailing 197, format catalog and 465 informats and 488 INPUT statement and 197 single trailing 130, automatic macro variables 523 AUTONAME option, OUTPUT statement (MEANS) , AXIS statement, GCHART procedure 413, 421 ORDER= option 421
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
Nutech Computer Training Institute 1682 E. Gude Dr. #102, Rockville, MD. 20850 Tel:301-610-9300 Website: www.nutechtraining.com SAS Hands-On Programming Training Outline Total Hours: 96 hrs Package Tuition
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
Faculty: Real time and certified SAS Online Training Course Content (Includes theoretical as well as practical sessions) BASICS BEFORE STARTING SAS: DATAWAREHOSING Concepts What is ETL ETL Concepts What
Preparing your data for analysis using SAS Landon Sego 24 April 2003 Department of Statistics UW-Madison Assumptions That you have used SAS at least a few times. It doesn t matter whether you run SAS in
AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health INTRODUCTION There are a number of SAS tools that you may never have to use. Why? The main reason
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
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,
Paper 253-29 The Input Statement: Where It's @ Ronald Cody, Ed.D., Robert Wood Johnson Medical School, Piscataway, NJ Introduction One of the most powerful features of SAS software is the ability to read
Tales from the Help Desk 3: More Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board INTRODUCTION In 20 years as a SAS consultant at the Federal Reserve Board, I have seen SAS users make
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
Chapter 1 Overview of the SQL Procedure 1.1 Features of PROC SQL...1-3 1.2 Selecting Columns and Rows...1-6 1.3 Presenting and Summarizing Data...1-17 1.4 Joining Tables...1-27 1-2 Chapter 1 Overview of
1 Using SAS outside of ITCs Statistical Methods and Computing, 22S:30/105 Instructor: Cowles Lab 1 Jan 31, 2014 You can access SAS from off campus by using the ITC Virtual Desktop Go to https://virtualdesktopuiowaedu
A Macro to Create Data Definition Documents Aileen L. Yam, sanofi-aventis Inc., Bridgewater, NJ ABSTRACT Data Definition documents are one of the requirements for NDA submissions. This paper contains a
RP301: Ad Hoc Business Intelligence Reporting State of Kansas As of April 28, 2010 Final TABLE OF CONTENTS Course Overview... 4 Course Objectives... 4 Agenda... 4 Lesson 1: Reviewing the Data Warehouse...
Microsoft Access Glossary of Terms A Free Document From www.chimpytech.com COPYRIGHT NOTICE This document is copyright chimpytech.com. Please feel free to distribute and give away this document to your
AN INTRODUCTION TO THE SQL PROCEDURE Chris Yindra, C Y Associates Abstract This tutorial will introduce the SQL (Structured Query Language) procedure through a series of simple examples We will initially
1. Base Programming GIORGIO RUSSOLILLO Cours de prépara+on à la cer+fica+on SAS «Base Programming» 9 What is SAS Highly flexible and integrated soiware environment; you can use SAS for: GIORGIO RUSSOLILLO
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
Paper 85-2010 Choosing the Right Tool from Your SAS and Microsoft Excel Tool Belt Steven First and Jennifer First, Systems Seminar Consultants, Madison, Wisconsin ABSTRACT There are over a dozen ways to
1 Checking Values of Character Variables Introduction 1 Using PROC FREQ to List Values 1 Description of the Raw Data File PATIENTS.TXT 2 Using a DATA Step to Check for Invalid Values 7 Describing the VERIFY,
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
Paper 126-29 Using Macros to Automate SAS Processing Kari Richardson, SAS Institute, Cary, NC Eric Rossland, SAS Institute, Dallas, TX ABSTRACT This hands-on workshop shows how to use the SAS Macro Facility
Access Queries (Office 2003) Technical Support Services Office of Information Technology, West Virginia University OIT Help Desk 293-4444 x 1 oit.wvu.edu/support/training/classmat/db/ Instructor: Kathy
Paper 11-27 Table Lookup: Techniques Beyond the Obvious Nancy Croonen, CC Training Services, Belgium ir. Henri Theuwissen, SOLID Partners, Belgium ABSTRACT Table lookup operations are often the most time
Methodologies for Converting Microsoft Excel Spreadsheets to SAS datasets Karin LaPann ViroPharma Incorporated ABSTRACT Much functionality has been added to the SAS to Excel procedures in SAS version 9.
Microsoft Office 2010: Access 2010, Excel 2010, Lync 2010 learning assets Simply type the id# in the search mechanism of ACS Skills Online to access the learning assets outlined below. Titles Microsoft
IBM DB2 Universal Database Business Intelligence Tutorial Version 7 IBM DB2 Universal Database Business Intelligence Tutorial Version 7 Before using this information and the product it supports, be sure
5. Crea+ng SAS Datasets from external files 107 Crea+ng a SAS dataset from a raw data file 108 LIBNAME statement In most of cases, you may want to assign a libref to a certain folder (a SAS library) LIBNAME
Paper 074-29 Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board INTRODUCTION In 19 years as a SAS consultant at the Federal Reserve Board, I have seen SAS users
https://udrive.oit.umass.edu/statdata/sas1.zip Introduction to SAS on Windows for SAS Versions 8 or 9 October 2009 I. Introduction...2 Availability and Cost...2 Hardware and Software Requirements...2 Documentation...2
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.
Tips, Tricks, and Techniques from the Experts Presented by Katie Ronk 2997 Yarmouth Greenway Drive, Madison, WI 53711 Phone: (608) 278-9964 Web: www.sys-seminar.com Systems Seminar Consultants, Inc www.sys-seminar.com
SAS Course Details By Besant Technologies Course Name Category Venue SAS (Base SAS, Advanced SAS & Clinical SAS) Analytical Services (BI) Besant Technologies No.24, Nagendra Nagar, Velachery Main Road,
3 CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases About This Document 3 Methods for Accessing Relational Database Data 4 Selecting a SAS/ACCESS Method 4 Methods for Accessing DBMS Tables
Integrating SAS and Excel: an Overview and Comparison of Three Methods for Using SAS to Create and Access Data in Excel Nathan Clausen, U.S. Bureau of Labor Statistics, Washington, DC Edmond Cheng, U.S.
1 Ability to access the database platforms desired (text, spreadsheet, Oracle, Sybase and other databases, OLAP engines.) Y Y 2 Ability to access relational data base Y Y 3 Ability to access dimensional
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
Technical Paper Reading Delimited Text Files into SAS 9 Release Information Content Version: 1.1July 2015 (This paper replaces TS-673 released in 2009.) Trademarks and Patents SAS Institute Inc., SAS Campus
Ad Hoc Advanced Table of Contents Functions... 1 Adding a Function to the Adhoc Query:... 1 Constant... 2 Coalesce... 4 Concatenate... 6 Add/Subtract... 7 Logical Expressions... 8 Creating a Logical Expression:...
Importing Excel Files Into SAS Using DDE Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA ABSTRACT With the popularity of Excel files, the SAS user could use an easy way to get Excel files
1 Ability to access the database platforms desired (text, spreadsheet, Oracle, Sybase and other databases, OLAP engines.) yes yes Brio is recognized for it Universal database access. Any source that is
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
Descriptive Statistics Categorical Variables 3 Introduction... 41 Computing Frequency Counts and Percentages... 42 Computing Frequencies on a Continuous Variable... 44 Using Formats to Group Observations...
David Shannon, Amadeus Software Limited ABSTRACT This paper discusses the uses of the SAS System within the pharmaceutical industry. It offers suggestions for programming best practices and coding hints
Paper 63-27 The Basics of Creating Graphs with SAS/GRAPH Software Jeff Cartier, SAS Institute Inc., Cary, NC ABSTRACT SAS/GRAPH software is a very powerful tool for creating a wide range of business and
Paper HOW-071 Tips and Tricks for Creating Multi-Sheet Microsoft Excel Workbooks the Easy Way with SAS Vincent DelGobbo, SAS Institute Inc., Cary, NC ABSTRACT Transferring SAS data and analytical results
Information Systems Services Importing and Exporting With TUT 117 Version 2.0 (Nov 2009) Contents 1. Introduction... 3 1.1 Aim of this Document... 3 2. Importing Data from Other Sources... 3 2.1 Reading
SAS/ACCESS 9.3 Interface to PC Files Reference SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2011. SAS/ACCESS 9.3 Interface to Files: Reference.
Tutorial 5 Creating Advanced Queries and Enhancing Table Design Microsoft Access 2013 Objectives Session 5.1 Review object naming standards Use the Like, In, Not, and & operators in queries Filter data
Paper TS600 Introduction to SAS Business Intelligence/Enterprise Guide Alex Dmitrienko, Ph.D., Eli Lilly and Company, Indianapolis, IN ABSTRACT This paper provides an overview of new SAS Business Intelligence
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.
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
MAS 500 Intelligence Tips and Tricks Booklet Vol. 1 1 Contents Accessing the Sage MAS Intelligence Reports... 3 Copying, Pasting and Renaming Reports... 4 To create a new report from an existing report...
Paper 55-28 Describing and Retrieving Data with SAS formats David Johnson, DKV-J Consultancies, Holmeswood, England ABSTRACT For many business users, the format procedure might be their favourite SAS procedure.
Intro to Excel spreadsheets What are the objectives of this document? The objectives of document are: 1. Familiarize you with what a spreadsheet is, how it works, and what its capabilities are; 2. Using
Going from Python to C Darin Brezeale December 8, 2011 Python is a high-level, interpreted language. C has many of the same types of programming constructs as in Python: arrays, loops, conditionals, functions,
SAS Data Management March, 2006 Introduction... 2 Reading Text Data Files... 2 INFILE Command Options... 2 INPUT Command Specifications... 2 Working with String Variables... 3 Upper and Lower Case String
BIRT: A Field Guide to Reporting x:.-. ^ 11 Diana Peh Alethea Hannemann Nola Hague AAddison-Wesley Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Parts
Automatically Converting Character Variables That Store Numbers to Numeric Variables Christopher J. Bost, MDRC, New York, NY ABSTRACT A character variable can store numbers, but many analyses require numeric
Paper 189 Using SAS/GRAPH Software to Create Graphs on the Web Himesh Patel, SAS Institute Inc., Cary, NC Revised by David Caira, SAS Institute Inc., Cary, NC ABSTRACT This paper highlights some ways of
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
Information Technology MS Access 2007 Users Guide ACCESS 2007 Importing and Exporting Data Files IT Training & Development (818) 677-1700 email@example.com TABLE OF CONTENTS Introduction... 1 Import Excel
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
Flat Pack Data: Converting and ZIPping SAS Data for Delivery Sarah Woodruff, Westat, Rockville, MD ABSTRACT Clients or collaborators often need SAS data converted to a different format. Delivery or even
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
MWSUG 2011 - Paper TS07 Taming the Interactive SAS Environment: Tips and Tricks for VIEWTABLE, The Enhanced Editor and More Roger D. Muller, Ph.D., First Phase Consulting, Carmel, IN Joshua M. Horstman,
Debugging Complex Macros Peter Stagg, Decision Informatics It s possible to write code generated by macros to an external file. The file can t be access until the SAS session has ended. Use the options
SAS BASE Certification 490 Questions + 50 Page Revision Notes (Free update to new questions for the Same Product) By SAS Certified Base Programmer for SAS 9 A00-211 SAS Certification Questions and Answers
Reading Difficult Raw Data Matthew Cohen Wharton Research Data Services ABSTRACT Raw data from outside sources is often messy and can be difficult to read into SAS. This paper will cover many of the features
Microsoft Access 007 Module http://pds.hccfl.edu/pds Microsoft Access 007: Module August 007 007 Hillsborough Community College - Professional Development and Web Services Hillsborough Community College
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.
ABSTRACT PharmaSUG 2011 - Paper SAS-AD02 Beyond the Basics: Advanced REPORT Procedure Tips and Tricks Updated for SAS 9.2 Allison McMahill Booth, SAS Institute Inc., Cary, NC, USA This paper is an update
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement
Moving Data From Excel To SAS And Back Again By Ben Cochran The Bedford Group firstname.lastname@example.org 1 Contents 1. Using DDE to Import Excel Data 2. Using the Import / Export Wizard 3. Using PROC IMPORT
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
Mike Zdeb (send comments, corrections to: email@example.com) #1 (1) INTRODUCTION Once, the acronym SAS actually did stand for Statistical Analysis System. Now, when you use the term SAS, you are referring
2 SQL in iseries Navigator In V4R4, IBM added an SQL scripting tool to the standard features included within iseries Navigator and has continued enhancing it in subsequent releases. Because standard features
You have got SASMAIL! Rajbir Chadha, Cognizant Technology Solutions, Wilmington, DE ABSTRACT As SAS software programs become complex, processing times increase. Sitting in front of the computer, waiting
Your consent to our cookies if you continue to use this website.