Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Importing Data into SAS: Techniques and Formats - Prof. D. Hitchcock, Study notes of Statistics

This document from the university of south carolina covers various methods for importing data into sas, including entering data directly, reading raw data files, converting other software's data files, and reading other software's data files directly. The document also discusses different data formats, such as data separated by spaces, data arranged in columns, and data not in standard format. It explains how to handle issues like missing values, messy data, and multiple lines of data per observation.

Typology: Study notes

Pre 2010

Uploaded on 10/01/2009

koofers-user-5gk
koofers-user-5gk 🇺🇸

10 documents

1 / 10

Toggle sidebar

Related documents


Partial preview of the text

Download Importing Data into SAS: Techniques and Formats - Prof. D. Hitchcock and more Study notes Statistics in PDF only on Docsity! STAT 517: Delwiche/Slaughter Chapter 2 Hitchcock/Grego Chapter 2: Getting Data Into SAS • Data stored in many different forms/formats. • Four categories of methods to read in data. 1. Entering data directly through keyboard (small data sets) 2. Creating SAS data sets from raw data files 3. Converting other software’s data files (e.g., Excel) into SAS data sets (my favorite!) 4. Reading other software’s data files directly (often need additional SAS/ACCESS products) University of South Carolina Page 1 STAT 517: Delwiche/Slaughter Chapter 2 Hitchcock/Grego Import Window • Allows you to import various types of data files (Microsoft Excel formats) • Default is for first row to be variable names. Change this using Options... button. • Options... button also selects worksheet from workbook. • Work library–data set deleted after exiting SAS. • Other libraries–data set saved after exiting SAS (but not necessarily library location). • Can save PROC IMPORT statements used to import the data. University of South Carolina Page 2 STAT 517: Delwiche/Slaughter Chapter 2 Hitchcock/Grego Data Arranged in Columns • Knowledge of this approach is less important nowadays • Important applications still exist • Each value of a variable is found at the same spot on the data line. • Advantages: 1. Don’t need space between values 2. Missing values don’t need special symbol (can be blank) 3. Character data can have blanks 4. Can skip variables you don’t need to read into SAS Example: INPUT var1 1-10 var2 11-15 var3 $ 16-30; University of South Carolina Page 5 STAT 517: Delwiche/Slaughter Chapter 2 Hitchcock/Grego Data Not in Standard Format • Types of non-standard data: 1. Numbers with commas or dollar signs 2. Dates and times of day • We can read nonstandard data using codes known as informats. • Most informats end in . (so SAS won’t confuse them with a variable) • Import from Excel often assigns informats automatically • p. 44-45 lists many SAS informats (Note that date informats are converted to a numerical value, Julian date) University of South Carolina Page 6 STAT 517: Delwiche/Slaughter Chapter 2 Hitchcock/Grego Other Inputting Issues: • You can mix input styles: read in some variables list-style; others column-style; others using informats; even the order can be shuffled! • E.g., you can explicitly move SAS to a specific column number. Example: @50 moves SAS to the 50th column. Messy Data • colon modifier: Tells SAS exactly how many columns long a variable’s field is, but stops when it reaches a space. • Example: Deptname :$15. tells SAS to read Deptname for 15 characters or until it reaches a space. • This method is not appropriate for character data with embedded spaces University of South Carolina Page 7
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved