Importing Data into SAS



Similar documents
Importing Data into R

Methodologies for Converting Microsoft Excel Spreadsheets to SAS datasets

Step 2: Save the file as an Excel file for future editing, adding more data, changing data, to preserve any formulas you were using, etc.

Efficient and effective management of big databases in Stata

How to Download Census Data from American Factfinder and Display it in ArcMap

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

SAS/ACCESS 9.3 Interface to PC Files

NCSS Statistical Software

Microsoft Office. Mail Merge in Microsoft Word

Paper Creating SAS Datasets from Varied Sources Mansi Singh and Sofia Shamas, MaxisIT Inc, NJ

Downloading Your Financial Statements to Excel

Instructions for Configuring a SAS Metadata Server for Use with JMP Clinical

Using SPSS, Chapter 2: Descriptive Statistics

2: Entering Data. Open SPSS and follow along as your read this description.

ABSTRACT INTRODUCTION SAS AND EXCEL CAPABILITIES SAS AND EXCEL STRUCTURES

5. Crea+ng SAS Datasets from external files. GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming»

Scientific Graphing in Excel 2010

INTERMEDIATE Excel 2013

Tales from the Help Desk 3: More Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board

How to Import Data into Microsoft Access

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

Reading Delimited Text Files into SAS 9 TS-673

A Recursive SAS Macro to Automate Importing Multiple Excel Worksheets into SAS Data Sets

Technical Paper. Reading Delimited Text Files into SAS 9

Tutorial 2: Reading and Manipulating Files Jason Pienaar and Tom Miller

Importing from Tab-Delimited Files

Access Tutorial 1 Creating a Database

- 1 - Guidance for the use of the WEB-tool for UWWTD reporting

SPSS Workbook 1 Data Entry : Questionnaire Data

SAS Lesson 2: More Ways to Input Data

Coupling Microsoft Excel with NI Requirements Gateway

with its unique General Ledger Drill Down feature, for any accounting software.

Miller s School Software Quick Start Guide.

2. The Open dialog box appears and you select Text Files (*.prn,*.txt,*.csv) from the drop-down list in the lower right-hand corner.

Excel 2013 Sort: Custom Sorts, Sort Levels, Changing Level & Sorting by Colored Cells

Creating an Excel Spreadsheet for Mail Merge. Excel Spreadsheet Mail Merge. 1 of 9 Design & Print Offline: Mail Merge

EXCEL IMPORT user guide

Company Setup 401k Tab

SPSS INSTRUCTION CHAPTER 1

Introduction to IBM Watson Analytics Data Loading and Data Quality

3. (1.0 point) To ungroup worksheets, you can click a sheet of a sheet not in the group. a. index b. panel c. tab d. pane

Migrating from SAS 9.3 to SAS 9.4: SAS communicating with MS Office Products

Step by Step Guide to Importing Genetic Data into JMP Genomics

Flat Pack Data: Converting and ZIPping SAS Data for Delivery

FINANCIAL INTEGRATION UTILITY GUIDE

Campaign Monitor. Quick Reference Guid e

quick start guide A Quick Start Guide inflow Support GET STARTED WITH INFLOW

Creating Raw Data Files Using SAS. Transcript

Radius Maps and Notification Mailing Lists

Basics Series-4004 Database Manager and Import Version 9.0

Combining SAS LIBNAME and VBA Macro to Import Excel file in an Intriguing, Efficient way Ajay Gupta, PPD Inc, Morrisville, NC

Aspose.Cells Product Family

Introduction to RStudio

RA MODEL VISUALIZATION WITH MICROSOFT EXCEL 2013 AND GEPHI

4 Other useful features on the course web page. 5 Accessing SAS

Lab 11: Budgeting with Excel

MAIL MERGE TIPS FOR PC USERS

UOFL SHAREPOINT ADMINISTRATORS GUIDE

Formatting Report Output to MS Excel

edgebooks Quick Start Guide 4

Working with Macros and VBA in Excel 2007

Using the SAS Enterprise Guide (Version 4.2)

Getting Your Data into SAS

EARTHSOFT DNREC. EQuIS Data Processor Tutorial

Important Tips when using Ad Hoc

CowCalf5. for Dummies. Quick Reference. D ate: 3/26 /

Writing Data with Excel Libname Engine

MyMaths. User Guide for Teachers. Secondary Level

Using Big Datasets in Stata

The first thing to do is choose if you are creating a mail merge for printing or an merge for distribution over .

How To Use Optimum Control EDI Import. EDI Invoice Import. EDI Supplier Setup General Set up

Microsoft Excel 2013 Tutorial

SECTION 5: Finalizing Your Workbook

R FOR SAS AND SPSS USERS. Bob Muenchen

Importing and Exporting Databases in Oasis montaj

USER MANUAL (PRO-CURO LITE, PRO & ENT) [SUPPLIED FOR VERSION 3]

Excel basics. Before you begin. What you'll learn. Requirements. Estimated time to complete:

Before You Begin... 2 Running SAS in Batch Mode... 2 Printing the Output of Your Program... 3 SAS Statements and Syntax... 3

Introduction to the TI Connect 4.0 software...1. Using TI DeviceExplorer...7. Compatibility with graphing calculators...9

QUALTRICS SURVEY SOFTWARE (BlueQ 2015)

Data Integration Guidelines

Data Analysis Stata (version 13)

How To Write A File System On A Microsoft Office (Windows) (Windows 2.3) (For Windows 2) (Minorode) (Orchestra) (Powerpoint) (Xls) (

SPSS Introduction. Yi Li

Google Apps for Sharing Folders and Collecting Assignments

Helpful Information is found at this page:

LEARNING MANAGEMENT SYSTEM USER GUIDE: TURNITIN GRADEMARK RUBRICS

SPSS: Getting Started. For Windows

Import and Output XML Files with SAS Yi Zhao Merck Sharp & Dohme Corp, Upper Gwynedd, Pennsylvania

FrontPage 2003: Forms

A short simple tutorial on. SAS libname statements. for SAS for Windows

A Demonstration of Hierarchical Clustering

SPREADSHEETS. TIP! Whenever you get some new data, save it under a new name! Then if you mess things up, you can always go back to the original.

Transcription:

1 SAS is a commonly used statistical program utilized for a variety of analyses. SAS supports many types of files as input and the following tutorial will cover some of the most popular. SAS Libraries: Using a SAS library is the best way to save your SAS dataset. By default, data is placed in a temporary library called the work library. A library may be created by specifying a folder in which to store the SAS dataset. libname adata "S:\BERD"; Creates a SAS library named adata. Any data stored in the adata library will be saved into the folder S:\BERD. To save a data set called example in the adata library, we use the following line of code: data adata.example; set example; Inputting data: Data may be directly input into SAS using a data step. This can take two forms. The first initializes and names the variables using an input statement and then uses the datalines statement to input one observation in each line. data ex1; input id y x; datalines; 1 2.1 3.2 2 3.4 4.1 3 2.0 2.9 4 4.2 6.0 5 1.5 2.7 ;

2 The second initializes and names the variables using an input statement and then uses the datalines statement to input multiple observations in each line. Text variables should be followed by $ in the input statement. To input multiple observations in each line, follow the variable names with @@ in the input statement. This indicates to SAS that a new observation begins with every other entry. data ex2; input id $ area @@; datalines; y1 1571 y1 814 y1 2150 y1 1761 y2 838 y2 613 y2 1240 y2 1297 y3 1596 y3 1000 y3 1216 y4 2072 y4 1155 y4 773 y4 1666 ; Importing from text (.txt) file: Next, we address importing the text file. If your data file is a simple text file, this is the statement you use: Data\ex3.txt" out=ex3 getnames=no; You will now have a SAS data set that you can analyze, create graphs with, or otherwise manipulate as needed. This is the most basic.txt import, but there are other options that are included. Say, for example, the first line of your data set contained column names. The above function call would have those column names be the first entry in your data set (and names the columns VAR1 to VARn). To fix this and have the column names properly displayed you would change getnames=no to getnames=yes:

3 Data\ex3.txt" out=ex3 This will take the first row of your data file and correctly interpret it as the names of the columns in your SAS data set. If you have a data file where each row is separated by a character, such as,, for instance, you can use the delimiter= option. Data\ex4.txt" out=ex4 delimiter=","; If you have a tab delimited data file, which are somewhat common, you should use: Data\ex5.txt" out=ex5 delimiter='09'x; There are many more options you can utilize with proc import if you have a data set that won t import properly or just want to format it in a different way. If you have an interest or need of these additional options, go to: http://support.sas.com/documentation/cdl/en/proc/65145/html/default/viewer.htm#n1 8jyszn33umngn14czw2qfw7thc.htm

4 This will direct you to the SAS support site and give you a detailed view of all the options available to you. Importing from excel (.xls,.xlsx,.csv) file: To import from excel as an excel spread sheet file: Data\ex6.xls" out=ex6 dbms=xls sheet="sheet1"; mixed=yes; Note that both.xls and.xlsx files may be imported. To import a.xlsx file, simply change xls to xlsx in both the datafile line and the dbms line. The name in the sheet line should be the specific sheet in your excel workbook you wish to import. For this example, the data is found on Sheet1.

5 To import from excel as a CSV (comma delimited) file: Data\ex7.csv" out=ex7 dbms=csv Importing from other Statistical Software: SAS also has the ability to import data files from other statistical software packages, such as SPSS, STATA, and JMP. In this tutorial we will look at SPSS. Data\ex8.sav" out=ex8 dbms=sav A particularly nice feature about importing SPSS data files is that variable labels and lengths are retained in the import. Another nice feature of importing SPSS data files is that any variable formats (value labels) are automatically imported to SAS from SPSS.