17. Reading free-format data. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 386

Size: px
Start display at page:

Download "17. Reading free-format data. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 386"

Transcription

1 17. Reading free-format data 386

2 Reading free format data: The list input A raw dataset is free-format when it is not arranged in fixed fields. -> Fields are separated by a delimiter List input allows reading standard and non-standard data DATA SAS-dataset(s) ; INFILE file-specifica+on <op+ons> ; INPUT variable <$> ; - In list input you dont need to specify startcol and endcol - you indicate a delimiter (Default = ) for separa)ng the fields Because list input does not specify column loca)ons, - All fields must be separated by at least one blank or another delimiter - Fields must be read in order from le to right - You cannot skip or re-read fields 387

3 The op)on DLM= DLM is an op)on of the INFILE statement: INFILE file-specifica+on DLM= delimiter(s); delimiter(s) can be: - a list of (up to 200) characters (inclosed in quota)on marks) to read as delimiters. - The delimiter must NOT be a character that occurs in a data value - a character variable whose value become the delimiter DELIMITER= is an alias for DLM= FILENAME import "\\psf\home\documents\my SAS Files\ReadingRawData\Freefinput.txt"; DATA imp_freefinput; INFILE import DLM= ","; INPUT Gender $ Age Height Years; PROC PRINT DATA = imp_freefinput; 388

4 Specifying a list of variables When using List input, you can specify a range of variables in the INPUT statement. If you specify a range of character variables both the variables names and the $ symbol must be enclosed in parentheses. E.g.: - INPUT Gio1-Gio3; - INPUT (Gio1-Gio3) ($); 389

5 Reading missing values at the end of a record MISSOVER is an op)on of the INFILE statement: INFILE file-specifica+on MISSOVER ; - The MISSOVER op)on prevents SAS from reading the next record if, when using list input, it does not find values in the current line for all the INPUT statement variables. - At the end of the current record, values that are expected but not found are set to missing. 390

6 Reading missing data at the beginning or middle of a record DSD is an op)on of the INFILE statement: INFILE file-specifica+on DSD ; The DSD op)on is used to read raw data when there is a missing value in the middle of a record The Delimiter Sensi)ve Data (DSD) op)on: - Treats two consecu)ve delimiters as a missing value - Removes quota)on marks from values - NB: It sets the default delimiter to a comma* *If the data uses mul)ple delimiters or a single delimiter other that a comma, simply specify delimiter values(s) in the DLM= op)on The DSD op)on can also be used to read raw data when there is a missing value at the beginning of a record, as long as a delimiter precedes the first value in the record 391

7 Example: MISSOVER and DSD (1) FILENAME import '\\psf\home\documents\my SAS Files\ReadingRawData\FreefMDinput.txt'; DATA imp_freefmdinput; INFILE import; INPUT Gender $ Age Height Years; PROC PRINT data=imp_freefmdinput; SAS misinterprets the the second line and it cannot read the third we need MISSOVER FILENAME import '\\psf\home\documents\my SAS Files\ReadingRawData\FreefMDinput.txt'; DATA imp_freefmdinput; INFILE import MISSOVER ; INPUT Gender $ Age Height Years; PROC PRINT data=imp_freefmdinput; Problem at the fi h line we need DSD 392

8 Example: MISSOVER and DSD (2) DATA imp_freefmdinput; INFILE import MISSOVER DSD; INPUT Gender $ Age Height Years; PROC PRINT DATA = imp_freefmdinput; The default delimiter when using DSD is comma DATA imp_freefmdinput; INFILE import MISSOVER DSD DLM=" "; INPUT Gender $ Age Height Years; PROC PRINT DATA = imp_freefmdinput;.. we need DLM= op)on! 393

9 The LENGTH statement - When using list input, character variables are assigned a default length of 8 - If they are longer than 8, they are truncated - You can avoid trunca)ng if you add a LENGTH statement before the input statement FILENAME import '\\psf\home\documents\my SAS Files\ReadingRawData\Lengthlis)nput.txt'; DATA imp_lengthlis)nput; INFILE import OBS=3; NB: OBS= and FIRSTOBS= work also in INFILE statement LENGTH City $ 12; INPUT City Pop86; PROC PRINT data=imp_lengthlis)nput; N.B.: - Using LENGTH statement, you do not need to specify variable s type in the INPUT statement. However, leaving the $ in the INPUT statement will not produce an error - A variable that is defined in a LENGTH statement will appear first in the dataset, since it precedes the INPUT statement 394

10 Modified list input: Reading values containing embedded blanks - The ampersand (&) modifier enables you to read character values that contain single embedded blanks. - The value is read un)l two or more consecubve blanks are encountered - NO other delimiter can be used to indicate the end of each field FILENAME import '\\psf\home\documents\my SAS Files\ReadingRawData\Lengthlis)nput.txt'; DATA imp_lengthlis)nput; INFILE import; LENGTH City $ 12; INPUT City & Pop86; PROC PRINT data=imp_lengthlis)nput; You can also read the values for City with the & modifier followed the $w. informat, which determines the variable length (it should be large enough to accomodate the longest value): DATA imp_lengthlis)nput; INFILE import; INPUT City & $12. Pop86; 395

11 Modified list input: Reading nonstandard values INPUT variable : informat ; - The colon (:) modifier enables you to read - nonstandard values - character values that are longer that 8 characters, but which contain no embedded blanks. - The : indicates that values are read un)l a delimiter is encountered, and then an informat is applied - If an informat for reading character values is specified, the w value specifies the variable s length in the SAS dataset (NOT the number of columns to be read in the source file!!), overriding the default length - N.B.: This is different from using a numeric informat with forma{ed input. In forma{ed input, you must specify a w value in order to indicate the number of columns of the field to read 396

12 Reading non standard values : an example Impor)ng the dataset Modlis)nput: FILENAME import '\\psf\home\documents\my SAS Files\ReadingRawData\Modlis)nput.txt'; DATA imp_modlis)nput; INFILE import; INPUT Rank City & $12. Pop86 : COMMA. ; PROC PRINT data=imp_modlis)nput; Impor)ng the dataset Modlis)nput2: FILENAME import '\\psf\home\documents\my SAS Files\ReadingRawData\Modlis)nput2.txt'; DATA imp_modlis)nput2; INFILE import DSD ; INPUT Rank City : $12. Pop86 : COMMA. ; PROC PRINT data=imp_modlis)nput2; 397

13 Mixing input styles: an example FILENAME import '\\psf\home\documents\my SAS Files\ReadingRawData\Mixinput.txt'; DATA imp_mixinput; INFILE import ; INPUT SSN $ HireDate Salary COMMA6. Dept : $9. Phone $ ; PROC PRINT data=imp_mixinput; Field DescripBon StarBng Column Field Width Data type Input Style SSN 1 11 character column Date of Hire 13 7 date forma{ed Annual Salary 21 6 numeric forma{ed Department 28 5 to 9 character list Phone Extension? 4 character list 398

14 Crea)ng Free-format Data: two alterna)ves FILE file-specifica+on <DLM= delimiter other-op+ons> ; PUT variable <: format> ; - variable : name of the variable whose value is wri{en - : : precedes format - format : specifies the format to use for wri)ng the data values PROC EXPORT DATA = SAS-dataset ; OUTFILE= filename <DLM= delimiter > ; RUN ; - SAS-dataset : name of the SAS-dataset to export - filename : the complete path and filename of the output - delimiter : specifies the delimiter to separate columns of data in the output file 399

15 Crea)ng Free-format Data: specifying a delimiter FILE file-specifica+on <DLM= delimiter other-op+ons> ; You can use the DLM = op)on with a FILE statement to create character-delimiter raw data flies PROC PRINT DATA=sasuser.finance; DATA _NULL_; SET sasuser.finance; FILE "\\psf\home\documents\my SAS Files\myoutputs\finance" DLM = "," ; PUT SSN Name Salary : COMMA. Date : DATE9.; 400

16 Crea)ng Free-format Data: using the DSD op)on FILE file-specifica+on <DLM= delimiter other-op+ons> ; Let s suppose you want to create a comma-delimited file in which there are values with a format requiring commas. The file finance may be misunderstood if the above program is used! You can use the DSD op)on in the FILE statement to specify that values containing commas should be enclosed in quota)on marks DATA _NULL_; SET sasuser.finance; FILE "\\psf\home\documents\my SAS Files\myoutputs\finance2" DSD ; PUT SSN Name Salary : COMMA. Date : DATE9.; NB: the DSD op)on uses a comma as a delimiter, so the DLM = op)on is not necessary here 401

17 Reading values that contain delimiters within a quoted string You can use the DSD op)on in an INFILE statement to read values that contain delimiters within a quoted string: FILENAME import "\\psf\home\documents\my SAS Files\myoutputs\finance2"; DATA work.finance2; INFILE import DSD; INPUT SSN : $11. Name $ Salary : COMMA. Date : DATE9. ; PROC PRINT DATA = finance2; FORMAT Date DATE9. ; 402

16. Reading raw data in fixed fields. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 364

16. Reading raw data in fixed fields. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 364 16. Reading raw data in fixed fields 364 Reading raw Dataset: three solu)ons You can mix all of them! Data that SAS cannot read without further informa)on 365 Reading standard data with column input: review

More information

Chapter 2: Getting Data Into SAS

Chapter 2: Getting Data Into SAS Chapter 2: Getting Data Into SAS Data stored in many different forms/formats. Four categories of ways to read in data. 1. Entering data directly through keyboard 2. Creating SAS data sets from raw data

More information

DSCI 325: Handout 2 Getting Data into SAS Spring 2017

DSCI 325: Handout 2 Getting Data into SAS Spring 2017 DSCI 325: Handout 2 Getting Data into SAS Spring 2017 Data sets come in many different formats. In some situations, data sets are stored on paper (e.g., surveys) and other times data are stored in huge

More information

9. Producing HTML output. GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming» 207

9. Producing HTML output. GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming» 207 9. Producing HTML output 207 The Output Delivery System (ODS) With ODS, you can easily create output in a variety of formats including: - HyperText Markup Language (HTML) output - RTF output - PDF output

More information

9. Producing HTML output. GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming» 208

9. Producing HTML output. GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming» 208 9. Producing HTML output 208 The Output Delivery System (ODS) With ODS, you can easily create output in a variety of formats including: - HyperText Markup Language (HTML) output - RTF output - PDF output

More information

ECLT 5810 SAS Programming - Introduction

ECLT 5810 SAS Programming - Introduction ECLT 5810 SAS Programming - Introduction Why SAS? Able to process data set(s). Easy to handle multiple variables. Generate useful basic analysis Summary statistics Graphs Many companies and government

More information

SAS Certification Handout #6: Ch

SAS Certification Handout #6: Ch SAS Certification Handout #6: Ch. 16-18 /************ Ch. 16 ******************* /* Suppose we have numeric variables ModelNumber Price Weight Change and date variable Date, plus a string variable Designer

More information

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority SAS 101 Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23 By Tasha Chapman, Oregon Health Authority Topics covered All the leftovers! Infile options Missover LRECL=/Pad/Truncover

More information

Chapter 7 File Access. Chapter Table of Contents

Chapter 7 File Access. Chapter Table of Contents Chapter 7 File Access Chapter Table of Contents OVERVIEW...105 REFERRING TO AN EXTERNAL FILE...105 TypesofExternalFiles...106 READING FROM AN EXTERNAL FILE...107 UsingtheINFILEStatement...107 UsingtheINPUTStatement...108

More information

Other Data Sources SAS can read data from a variety of sources:

Other Data Sources SAS can read data from a variety of sources: Other Data Sources SAS can read data from a variety of sources: Plain text files, including delimited and fixed-column files Spreadsheets, such as Excel Databases XML Others Text Files Text files of various

More information

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS TO SAS NEED FOR SAS WHO USES SAS WHAT IS SAS? OVERVIEW OF BASE SAS SOFTWARE DATA MANAGEMENT FACILITY STRUCTURE OF SAS DATASET SAS PROGRAM PROGRAMMING LANGUAGE ELEMENTS OF THE SAS LANGUAGE RULES FOR SAS

More information

MARK CARPENTER, Ph.D.

MARK CARPENTER, Ph.D. MARK CARPENTER, Ph.D. Module 1 : THE DATA STEP (1, 2, 3) Keywords : DATA, INFILE, INPUT, FILENAME, DATALINES Procedures : PRINT Pre-Lecture Preparation: create directory on your local hard drive called

More information

The INPUT Statement: Where

The INPUT Statement: Where The INPUT Statement: Where It's @ Ronald Cody, Ed.D. Robert Wood Johnson Medical School Introduction One of the most powerful features of SAS software is the ability to read data in almost any form. For

More information

Accessing Data and Creating Data Structures. SAS Global Certification Webinar Series

Accessing Data and Creating Data Structures. SAS Global Certification Webinar Series Accessing Data and Creating Data Structures SAS Global Certification Webinar Series Accessing Data and Creating Data Structures Becky Gray Certification Exam Developer SAS Global Certification Michele

More information

Getting Your Data into SAS The Basics. Math 3210 Dr. Zeng Department of Mathematics California State University, Bakersfield

Getting Your Data into SAS The Basics. Math 3210 Dr. Zeng Department of Mathematics California State University, Bakersfield Getting Your Data into SAS The Basics Math 3210 Dr. Zeng Department of Mathematics California State University, Bakersfield Outline Getting data into SAS -Entering data directly into SAS -Creating SAS

More information

Base and Advance SAS

Base and Advance SAS Base and Advance SAS BASE SAS INTRODUCTION An Overview of the SAS System SAS Tasks Output produced by the SAS System SAS Tools (SAS Program - Data step and Proc step) A sample SAS program Exploring SAS

More information

The INPUT Statement: Where It

The INPUT Statement: Where It The INPUT Statement: Where It s @ Ron Cody email: ron.cody@gmail.com Author page: Support.sas.com/cody List Directed Input data list input X Y A $ Z datalines 1 2 hello 3 4 5 goodbye 6 title 'List Directed

More information

Creation of SAS Dataset

Creation of SAS Dataset Creation of SAS Dataset Contents SAS data step Access to PC files Access to Oracle Access to SQL 2 SAS Data Step Contents Creating SAS data sets from raw data Creating and managing variables 3 Creating

More information

2. Referencing Files and Sepng Op+ons. GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming» 47

2. Referencing Files and Sepng Op+ons. GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming» 47 2. Referencing Files and Sepng Op+ons GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming» 47 Defining SAS libraries To reference a permanent SAS file you: - Assign a name (libref)

More information

Reading data in SAS and Descriptive Statistics

Reading data in SAS and Descriptive Statistics P8130 Recitation 1: Reading data in SAS and Descriptive Statistics Zilan Chai Sep. 18 th /20 th 2017 Outline Intro to SAS (windows, basic rules) Getting Data into SAS Descriptive Statistics SAS Windows

More information

The Programmer's Solution to the Import/Export Wizard

The Programmer's Solution to the Import/Export Wizard The Programmer's Solution to the Import/Export Wizard Lora D. Delwiche, University of California, Davis, CA Susan J. Slaughter, SAS Consultant, Davis, CA Abstract Do you like what the Import/Export Wizard

More information

MATH 707-ST: Introduction to Statistical Computing with SAS and R. MID-TERM EXAM (Writing part) Fall, (Time allowed: TWO Hours)

MATH 707-ST: Introduction to Statistical Computing with SAS and R. MID-TERM EXAM (Writing part) Fall, (Time allowed: TWO Hours) MATH 707-ST: Introduction to Statistical Computing with SAS and R MID-TERM EXAM (Writing part) Fall, 2013 (Time allowed: TWO Hours) Highlight your answer clearly for each question. There is only one correct

More information

Moving Data and Results Between SAS and Excel. Harry Droogendyk Stratia Consulting Inc.

Moving Data and Results Between SAS and Excel. Harry Droogendyk Stratia Consulting Inc. Moving Data and Results Between SAS and Excel Harry Droogendyk Stratia Consulting Inc. Introduction SAS can read ( and write ) anything Introduction In the end users want EVERYTHING in. Introduction SAS

More information

Stat 302 Statistical Software and Its Applications SAS: Data I/O & Descriptive Statistics

Stat 302 Statistical Software and Its Applications SAS: Data I/O & Descriptive Statistics Stat 302 Statistical Software and Its Applications SAS: Data I/O & Descriptive Statistics Fritz Scholz Department of Statistics, University of Washington Winter Quarter 2015 February 19, 2015 2 Getting

More information

SAS PROGRAMMING AND APPLICATIONS (STAT 5110/6110): FALL 2015 Module 2

SAS PROGRAMMING AND APPLICATIONS (STAT 5110/6110): FALL 2015 Module 2 SAS PROGRAMMING AND APPLICATIONS (STAT 5110/6110): FALL 2015 Department of MathemaGcs and StaGsGcs Phone: 4-3620 Office: Parker 364- A E- mail: carpedm@auburn.edu Web: hup://www.auburn.edu/~carpedm/stat6110

More information

SAS CURRICULUM. BASE SAS Introduction

SAS CURRICULUM. BASE SAS Introduction SAS CURRICULUM BASE SAS Introduction Data Warehousing Concepts What is a Data Warehouse? What is a Data Mart? What is the difference between Relational Databases and the Data in Data Warehouse (OLTP versus

More information

ASSIGNMENT #2 ( *** ANSWERS ***) 1

ASSIGNMENT #2 ( *** ANSWERS ***) 1 ASSIGNMENT #2 ( *** ANSWERS ***) 1 * problem #1 *** WHERE WILL THE PERMANENT SAS DATA SET BE WRITTEN libname x 'i:\' CREATE A PERMANENT SAS DATA SET NAMED CLINICAL USE AN INFILE STATEMENT TO TELL SAS WHERE

More information

Use That SAP to Write Your Code Sandra Minjoe, Genentech, Inc., South San Francisco, CA

Use That SAP to Write Your Code Sandra Minjoe, Genentech, Inc., South San Francisco, CA Paper DM09 Use That SAP to Write Your Code Sandra Minjoe, Genentech, Inc., South San Francisco, CA ABSTRACT In this electronic age we live in, we usually receive the detailed specifications from our biostatistician

More information

Write SAS Code to Generate Another SAS Program A Dynamic Way to Get Your Data into SAS

Write SAS Code to Generate Another SAS Program A Dynamic Way to Get Your Data into SAS Paper 175-29 Write SAS Code to Generate Another SAS Program A Dynamic Way to Get Your Data into SAS Linda Gau, Pro Unlimited @ Genentech, Inc., South San Francisco, CA ABSTRACT In this paper we introduce

More information

Biostatistics 600 SAS Lab Supplement 1 Fall 2012

Biostatistics 600 SAS Lab Supplement 1 Fall 2012 Biostatistics 600 SAS Lab Supplement 1 Fall 2012 p 2. How to Enter Data in the Program Editor Window: Instream Data p 5. How to Create a SAS Data Set from Raw Data Files p 16. Using Dates in SAS 1 How

More information

Stat 302 Statistical Software and Its Applications SAS: Data I/O

Stat 302 Statistical Software and Its Applications SAS: Data I/O Stat 302 Statistical Software and Its Applications SAS: Data I/O Yen-Chi Chen Department of Statistics, University of Washington Autumn 2016 1 / 33 Getting Data Files Get the following data sets from the

More information

CS101: Fundamentals of Computer Programming. Dr. Tejada www-bcf.usc.edu/~stejada Week 1 Basic Elements of C++

CS101: Fundamentals of Computer Programming. Dr. Tejada www-bcf.usc.edu/~stejada Week 1 Basic Elements of C++ CS101: Fundamentals of Computer Programming Dr. Tejada stejada@usc.edu www-bcf.usc.edu/~stejada Week 1 Basic Elements of C++ 10 Stacks of Coins You have 10 stacks with 10 coins each that look and feel

More information

Writing Programs in SAS Data I/O in SAS

Writing Programs in SAS Data I/O in SAS Writing Programs in SAS Data I/O in SAS Statistics 135 Autumn 2005 Copyright c 2005 by Mark E. Irwin Writing SAS Programs Your SAS programs can be written in any text editor, though you will often want

More information

IT 433 Final Exam. June 9, 2014

IT 433 Final Exam. June 9, 2014 Page 1 of 10 IT 433 Final Exam June 9, 2014 Part A: Multiple Choice Questions about SAS. Circle the most correct answer for each question. You may give an optional reason for each answer; if the answer

More information

15. Processing variables with arrays. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 343

15. Processing variables with arrays. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 343 15. Processing variables with arrays 343 SAS Arrays A SAS array is a temporary grouping of SAS variables under a single name. It exists only for the dura)on of the DATA step Useful for processing several

More information

BEYOND FORMAT BASICS 1

BEYOND FORMAT BASICS 1 BEYOND FORMAT BASICS 1 CNTLIN DATA SETS...LABELING VALUES OF VARIABLE One common use of a format in SAS is to assign labels to values of a variable. The rules for creating a format with PROC FORMAT are

More information

Introduction to SAS Mike Zdeb ( , #1

Introduction to SAS Mike Zdeb ( , #1 Mike Zdeb (402-6479, msz03@albany.edu) #1 (1) INTRODUCTION Once, the acronym SAS actually did stand for Statistical Analysis System. Now, when you use the term SAS, you are referring to a collection of

More information

SUGI 29 Data Warehousing, Management and Quality

SUGI 29 Data Warehousing, Management and Quality Building a Purchasing Data Warehouse for SRM from Disparate Procurement Systems Zeph Stemle, Qualex Consulting Services, Inc., Union, KY ABSTRACT SAS Supplier Relationship Management (SRM) solution offers

More information

Using an ICPSR set-up file to create a SAS dataset

Using an ICPSR set-up file to create a SAS dataset Using an ICPSR set-up file to create a SAS dataset Name library and raw data files. From the Start menu, launch SAS, and in the Editor program, write the codes to create and name a folder in the SAS permanent

More information

Objectives Reading SAS Data Sets and Creating Variables Reading a SAS Data Set Reading a SAS Data Set onboard ia.dfwlax FirstClass Economy

Objectives Reading SAS Data Sets and Creating Variables Reading a SAS Data Set Reading a SAS Data Set onboard ia.dfwlax FirstClass Economy Reading SAS Data Sets and Creating Variables Objectives Create a SAS data set using another SAS data set as input. Create SAS variables. Use operators and SAS functions to manipulate data values. Control

More information

Name: Batch timing: Date: The SAS data set named WORK.SALARY contains 10 observations for each department, currently ordered by DEPARTMENT.

Name: Batch timing: Date: The SAS data set named WORK.SALARY contains 10 observations for each department, currently ordered by DEPARTMENT. Q1. The following SAS program is submitted: data work.total; set work.salary(keep = department wagerate); by department; if first.department then payroll = 0; payroll + wagerate; if last.department; The

More information

ssh tap sas913 sas

ssh tap sas913 sas Fall 2010, STAT 430 SAS Examples SAS9 ===================== ssh abc@glue.umd.edu tap sas913 sas https://www.statlab.umd.edu/sasdoc/sashtml/onldoc.htm a. Reading external files using INFILE and INPUT (Ch

More information

Using Dynamic Data Exchange

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

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL

More information

Level I: Getting comfortable with my data in SAS. Descriptive Statistics

Level I: Getting comfortable with my data in SAS. Descriptive Statistics Level I: Getting comfortable with my data in SAS. Descriptive Statistics Quick Review of reading Data into SAS Preparing Data 1. Variable names in the first row make sure they are appropriate for the statistical

More information

(c) What is the result of running the following program? x = 3 f = function (y){y+x} g = function (y){x =10; f(y)} g (7) Solution: The result is 10.

(c) What is the result of running the following program? x = 3 f = function (y){y+x} g = function (y){x =10; f(y)} g (7) Solution: The result is 10. Statistics 506 Exam 2 December 17, 2015 1. (a) Suppose that li is a list containing K arrays, each of which consists of distinct integers that lie between 1 and n. That is, for each k = 1,..., K, li[[k]]

More information

18. Reading date and )me values. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 394

18. Reading date and )me values. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 394 18. Reading date and )me values 394 How SAS stores date values - A SAS date value is stored as the number of days from January 1, 1960, to the given date - A SAS Bme value is stored as the number of seconds

More information

Programming Environments

Programming Environments Programming Environments There are several ways of crea/ng a computer program Using an Integrated Development Environment (IDE) Using a text editor You should use the method you are most comfortable with.

More information

Exchanging data between SAS and Microsoft Excel

Exchanging data between SAS and Microsoft Excel Paper CC 011 Exchanging data between SAS and Microsoft Excel Yuqing Xiao, Southern Company, Atlanta, GA ABSTRACT Transferring data between SAS and Microsoft Excel has gained popularity over the years.

More information

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved.

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved. Restricting and Sorting Data Objectives After completing this lesson, you should be able to do the following: Limit the rows that are retrieved by a query Sort the rows that are retrieved by a query Use

More information

RESTRICTING AND SORTING DATA

RESTRICTING AND SORTING DATA RESTRICTING AND SORTING DATA http://www.tutorialspoint.com/sql_certificate/restricting_and_sorting_data.htm Copyright tutorialspoint.com The essential capabilities of SELECT statement are Selection, Projection

More information

A Macro that can Search and Replace String in your SAS Programs

A Macro that can Search and Replace String in your SAS Programs ABSTRACT MWSUG 2016 - Paper BB27 A Macro that can Search and Replace String in your SAS Programs Ting Sa, Cincinnati Children s Hospital Medical Center, Cincinnati, OH In this paper, a SAS macro is introduced

More information

Main Memory Organization

Main Memory Organization Main Memory Organization Bit Smallest piece of memory Stands for binary digit Has values 0 (off) or 1 (on) Byte Is 8 consecu>ve bits Word Usually 4 consecu>ve bytes Has an address 8 bits 0 1 1 0 0 1 1

More information

PROC IMPORT and more. Or: when PROC IMPORT just doesn't do the job

PROC IMPORT and more. Or: when PROC IMPORT just doesn't do the job ABSTRACT SESUG Paper BB-180-2017 PROC IMPORT and more. Or: when PROC IMPORT just doesn't do the job David B. Horvath, MS, CCP PROC IMPORT comes in handy when quickly trying to load a CSV or similar file.

More information

SAS Macro Language: Reference

SAS Macro Language: Reference SAS Macro Language: Reference INTRODUCTION Getting Started with the Macro Facility This is the macro facility language reference for the SAS System. It is a reference for the SAS macro language processor

More information

BIOMETRICS INFORMATION

BIOMETRICS INFORMATION BIOMETRICS INFORMATION (You re 95% likely to need this information) PAMPHLET NO. # 24 DATE: February 9, 1990 SUBJECT: Reading WATFILE files into SAS WATFILE is a useful package for data entry because it

More information

SAS/FSP 9.2. Procedures Guide

SAS/FSP 9.2. Procedures Guide SAS/FSP 9.2 Procedures Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2008. SAS/FSP 9.2 Procedures Guide. Cary, NC: SAS Institute Inc. SAS/FSP 9.2 Procedures

More information

What Is New in CSI-Data-Miner 6.0A and B?

What Is New in CSI-Data-Miner 6.0A and B? Data-Miner 6.0A "Auto" and "Task" mode scripts Data-Miner will now run in either "Auto" mode or "Task" mode. Auto is the way that previous versions of Data-Miner have operated with reading and writing

More information

MISSOVER, TRUNCOVER, and PAD, OH MY!! or Making Sense of the INFILE and INPUT Statements. Randall Cates, MPH, Technical Training Specialist

MISSOVER, TRUNCOVER, and PAD, OH MY!! or Making Sense of the INFILE and INPUT Statements. Randall Cates, MPH, Technical Training Specialist MISSOVER, TRUNCOVER, and PAD, OH MY!! or Making Sense of the INFILE and INPUT Statements. Randall Cates, MPH, Technical Training Specialist ABSTRACT The SAS System has many powerful tools to store, analyze

More information

Run your reports through that last loop to standardize the presentation attributes

Run your reports through that last loop to standardize the presentation attributes PharmaSUG2011 - Paper TT14 Run your reports through that last loop to standardize the presentation attributes Niraj J. Pandya, Element Technologies Inc., NJ ABSTRACT Post Processing of the report could

More information

Eventus Example Series Using Non-CRSP Data in Eventus 7 1

Eventus Example Series Using Non-CRSP Data in Eventus 7 1 Eventus Example Series Using Non-CRSP Data in Eventus 7 1 Goal: Use Eventus software version 7.0 or higher to construct a mini-database of data obtained from any source, and run one or more event studies

More information

Introduction OR CARDS. INPUT DATA step OUTPUT DATA 8-1

Introduction OR CARDS. INPUT DATA step OUTPUT DATA 8-1 Introduction Thus far, all the DATA step programs we have seen have involved reading and writing only SAS data sets. In this chapter we will present techniques to read and write external or "raw" files

More information

SYSTEM 2000 Essentials

SYSTEM 2000 Essentials 7 CHAPTER 2 SYSTEM 2000 Essentials Introduction 7 SYSTEM 2000 Software 8 SYSTEM 2000 Databases 8 Database Name 9 Labeling Data 9 Grouping Data 10 Establishing Relationships between Schema Records 10 Logical

More information

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

PASS4TEST. IT Certification Guaranteed, The Easy Way!  We offer free update service for one year PASS4TEST IT Certification Guaranteed, The Easy Way! \ http://www.pass4test.com We offer free update service for one year Exam : A00-201 Title : SAS base programming exam Vendors : SASInstitute Version

More information

Final Exam. STT 305 Summer 2017

Final Exam. STT 305 Summer 2017 Final Exam STT 305 Summer 2017 Question 1 For the text file and code given at the right, which is the correct data set? Answer A Here Answer B Here Figure Answer C Here No data set is produced, the input

More information

SAS Data Libraries. Objectives. Airline Data Library. SAS Data Libraries. SAS Data Libraries FILES LIBRARIES

SAS Data Libraries. Objectives. Airline Data Library. SAS Data Libraries. SAS Data Libraries FILES LIBRARIES Reading Raw Data, Formats and Data Types 2.1 SAS Data Libraries 2.2 SAS List Reports from SAS Data Sets 2.3 Formats in SAS 2.4 Reading Raw Data into SAS 2.5 Minitab List Reports from Minitab Worksheets

More information

Acquiring Staff IDs for Non-Payroll Staff

Acquiring Staff IDs for Non-Payroll Staff This applies to institutions that have personnel who are not on the institutions payroll, but require a Staff UID. The Staff UID process cannot be ran for non-payroll employees. A manual process must be

More information

Introduction to SAS Mike Zdeb ( , #61

Introduction to SAS Mike Zdeb ( , #61 Mike Zdeb (402-6479, msz03@albany.edu) #61 FORMAT, you can design informats for reading and interpreting non-standard data, and you can design formats for displaying data in non-standard ways....example

More information

USING SAS SOFTWARE TO COMPARE STRINGS OF VOLSERS IN A JCL JOB AND A TSO CLIST

USING SAS SOFTWARE TO COMPARE STRINGS OF VOLSERS IN A JCL JOB AND A TSO CLIST USING SAS SOFTWARE TO COMPARE STRINGS OF VOLSERS IN A JCL JOB AND A TSO CLIST RANDALL M NICHOLS, Mississippi Dept of ITS, Jackson, MS ABSTRACT The TRANSLATE function of SAS can be used to strip out punctuation

More information

EXST SAS Lab Lab #8: More data step and t-tests

EXST SAS Lab Lab #8: More data step and t-tests EXST SAS Lab Lab #8: More data step and t-tests Objectives 1. Input a text file in column input 2. Output two data files from a single input 3. Modify datasets with a KEEP statement or option 4. Prepare

More information

Deccansoft Software Services. SAS Syllabus

Deccansoft Software Services. SAS Syllabus Overview: SAS(Statistical Analysis Software or System) is one of the BI(Business intelligence tool),it is an integrated system of software products provided by SAS Institute.SAS was used for data management,predictive

More information

chapter 2 G ETTING I NFORMATION FROM A TABLE

chapter 2 G ETTING I NFORMATION FROM A TABLE chapter 2 Chapter G ETTING I NFORMATION FROM A TABLE This chapter explains the basic technique for getting the information you want from a table when you do not want to make any changes to the data and

More information

Data Set Options CHAPTER 2

Data Set Options CHAPTER 2 5 CHAPTER 2 Data Set Options Definition 6 6 Using Data Set Options 6 Using Data Set Options with Input or Output SAS Data Sets 6 How Data Set Options Interact with System Options 7 Data Set Options by

More information

QDS V4.0. New Features Documentation. NOVA Research Company

QDS V4.0. New Features Documentation. NOVA Research Company QDS V4.0 New Features Documentation NOVA Research Company Design Studio Features... 3 Data Element: Ranking Response Type... 3 Adding a Ranking Item... 3 Ranking Variables... 4 Automatic Variable New Type:

More information

ERROR: ERROR: ERROR:

ERROR: ERROR: ERROR: ERROR: ERROR: ERROR: Formatting Variables: Back and forth between character and numeric Why should you care? DATA name1; SET name; if var = Three then delete; if var = 3 the en delete; if var = 3 then

More information

BUSINESS ANALYTICS. 96 HOURS Practical Learning. DexLab Certified. Training Module. Gurgaon (Head Office)

BUSINESS ANALYTICS. 96 HOURS Practical Learning. DexLab Certified. Training Module. Gurgaon (Head Office) SAS (Base & Advanced) Analytics & Predictive Modeling Tableau BI 96 HOURS Practical Learning WEEKDAY & WEEKEND BATCHES CLASSROOM & LIVE ONLINE DexLab Certified BUSINESS ANALYTICS Training Module Gurgaon

More information

SAS Graphics & Code. stat 480 Heike Hofmann

SAS Graphics & Code. stat 480 Heike Hofmann SAS Graphics & Code stat 480 Heike Hofmann Outline Data Exploration in SAS Data Management Subsetting Graphics Code in SAS Your turn Download FBI crime data fbi-crime-60-11.csv from the website, open in

More information

Introductory Guide to SAS:

Introductory Guide to SAS: Introductory Guide to SAS: For UVM Statistics Students By Richard Single Contents 1 Introduction and Preliminaries 2 2 Reading in Data: The DATA Step 2 2.1 The DATA Statement............................................

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved. 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

More information

EXST3201 Mousefeed01 Page 1

EXST3201 Mousefeed01 Page 1 EXST3201 Mousefeed01 Page 1 3 /* 4 Examine differences among the following 6 treatments 5 N/N85 fed normally before weaning and 85 kcal/wk after 6 N/R40 fed normally before weaning and 40 kcal/wk after

More information

The EXPORT Procedure. Overview. Procedure Syntax CHAPTER 18

The EXPORT Procedure. Overview. Procedure Syntax CHAPTER 18 423 CHAPTER 18 The EXPORT Procedure Overview 423 Procedure Syntax 423 PROC EXPORT Statement 424 Data Source Statements 425 Examples 427 Example 1: Exporting a Delimited External File 427 Example 2: Exporting

More information

Introduction. Getting Started with the Macro Facility CHAPTER 1

Introduction. Getting Started with the Macro Facility CHAPTER 1 1 CHAPTER 1 Introduction Getting Started with the Macro Facility 1 Replacing Text Strings Using Macro Variables 2 Generating SAS Code Using Macros 3 Inserting Comments in Macros 4 Macro Definition Containing

More information

STAT:5400 Computing in Statistics

STAT:5400 Computing in Statistics STAT:5400 Computing in Statistics Introduction to SAS Lecture 18 Oct 12, 2015 Kate Cowles 374 SH, 335-0727 kate-cowles@uiowaedu SAS SAS is the statistical software package most commonly used in business,

More information

WRITE SAS CODE TO GENERATE ANOTHER SAS PROGRAM

WRITE SAS CODE TO GENERATE ANOTHER SAS PROGRAM WRITE SAS CODE TO GENERATE ANOTHER SAS PROGRAM A DYNAMIC WAY TO GET YOUR DATA INTO THE SAS SYSTEM Linda Gau, ProUnlimited, South San Francisco, CA ABSTRACT In this paper we introduce a dynamic way to create

More information

Formulas and Functions

Formulas and Functions Conventions used in this document: Keyboard keys that must be pressed will be shown as Enter or Ctrl. Controls to be activated with the mouse will be shown as Start button > Settings > System > About.

More information

FSEDIT Procedure Windows

FSEDIT Procedure Windows 25 CHAPTER 4 FSEDIT Procedure Windows Overview 26 Viewing and Editing Observations 26 How the Control Level Affects Editing 27 Scrolling 28 Adding Observations 28 Entering and Editing Variable Values 28

More information

Control Structures. CIS 118 Intro to LINUX

Control Structures. CIS 118 Intro to LINUX Control Structures CIS 118 Intro to LINUX Basic Control Structures TEST The test utility, has many formats for evaluating expressions. For example, when given three arguments, will return the value true

More information

Basic Macro Processing Prepared by Destiny Corporation

Basic Macro Processing Prepared by Destiny Corporation Basic Macro Processing Prepared by Destiny Corporation Macro variables In this module we discuss the first of the two special characters - the ampersand (&). When the SAS Supervisor sees an ampersand followed

More information

ERROR MESSAGES TROUBLESHOOTING... 2 OASIS SUBMISSION ERROR MESSAGES... 3 OASIS FILE PROCESSING ERROR MESSAGES... 3

ERROR MESSAGES TROUBLESHOOTING... 2 OASIS SUBMISSION ERROR MESSAGES... 3 OASIS FILE PROCESSING ERROR MESSAGES... 3 5 ERROR MESSAGES TROUBLESHOOTING... 2 OASIS SUBMISSION ERROR MESSAGES... 3 OASIS FILE PROCESSING ERROR MESSAGES... 3 12/2018 v1.07 Outcome and Assessment Information Set (OASIS) MESSAGES 5-1 Submission

More information

Sandra Hendren Health Data Institute

Sandra Hendren Health Data Institute INTRODUCTION TO THE MACRO LANGUAGE Sandra Hendren Health Data Institute The purpose of this paper is to explain the macro language at a conceptual level. It will not discuss the syntax of the language

More information

EXST SAS Lab Lab #6: More DATA STEP tasks

EXST SAS Lab Lab #6: More DATA STEP tasks EXST SAS Lab Lab #6: More DATA STEP tasks Objectives 1. Working from an current folder 2. Naming the HTML output data file 3. Dealing with multiple observations on an input line 4. Creating two SAS work

More information

Parse String at Web Client

Parse String at Web Client Parse String at Web Client Last updated: 2013-02-18 Contents The Sample Problem... 1 Create a Parse Method... 2 Use String Variable... 2 Split user input... 3 Get Number of Words... 5 Merge Array into

More information

&&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates

&&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates &&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates INTRODUCTION SAS macros are powerful tools that can create reusable code modules to do a variety of programming

More information

Some _FILE_ Magic Mike Zdeb, FSL, University at Albany School of Public Health, Rensselaer, NY

Some _FILE_ Magic Mike Zdeb, FSL, University at Albany School of Public Health, Rensselaer, NY SESUG 2016 Paper CC-171 Some _FILE_ Magic Mike Zdeb, FSL, University at Albany School of Public Health, Rensselaer, NY ABSTRACT The use of the SAS automatic variable _INFILE_ has been the subject of several

More information

Compute Blocks in Report

Compute Blocks in Report Compute Blocks in Report Compute Blocks Though it is always possible to compute new variables inside a data step, PROC REPORT allows for similar computations to be done internally as well. Computations

More information

Create a SAS Program to create the following files from the PREC2 sas data set created in LAB2.

Create a SAS Program to create the following files from the PREC2 sas data set created in LAB2. Topics: Data step Subsetting Concatenation and Merging Reference: Little SAS Book - Chapter 5, Section 3.6 and 2.2 Online documentation Exercise I LAB EXERCISE The following is a lab exercise to give you

More information

The SAS interface is shown in the following screen shot:

The SAS interface is shown in the following screen shot: The SAS interface is shown in the following screen shot: There are several items of importance shown in the screen shot First there are the usual main menu items, such as File, Edit, etc I seldom use anything

More information

Formats and the Format Procedure

Formats and the Format Procedure Formats and the Format Procedure Assigning Formats for Display While labels are used to change how a variable name is displayed, formats are used to change how data values are displayed. Formats are assigned

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2009, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2009, Oracle. All rights reserved. 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

More information

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement GIFT Department of Computing Science [Spring 2013] CS-217: Database Systems Lab-2 Manual Data Selection and Filtering using the SELECT Statement V1.0 4/12/2016 Introduction to Lab-2 This lab reinforces

More information