Unit_2_Working_with__SAS_data

Unit_2_Working_with__SAS_data - Introduction to SAS...

Info icon This preview shows pages 1–11. Sign up to view the full content.

1 Introduction to SAS Programming STSCI501 – Fall 2007 Simona Despa Cornell Statistical Consulting Unit (CSCU)
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

2 Part 2 Working with SAS data Overview Reading data into SAS: Excel, ASCII, or SAS data sets SAS Import Wizard SAS Data Steps Proc Import Use of SAS explorer for data sets created
Image of page 2
3 Data Types 1. Raw Data - Internal raw data: data are typed directly into the SAS program Works well with small amounts of data - External raw data files : data are external to SAS - referred to as text, ASCII, sequential or flat files
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

4 Data Types 2. Other software data files - Microsoft Excel, Lotus, dBase, Microsoft Access and JMP files can be imported into SAS using the Import Wizard; - SAS/ACCESS allows reading other software’s data files directly; data files are not converted to SAS data sets - external data are represented as if it is native to SAS - Stat/Transfer or DBMD/Copy are software translation packages that can convert data from other software data to SAS data sets
Image of page 4
5 Methods for Getting Data into SAS Data step method Proc Import method Point-and-Click method (Import Wizard)
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

6 Getting Your Data into SAS The data step is most flexible when your data are in raw files (ASCII, text, sequential or flat files) The Import Wizard and Proc Import are convenient methods for specific data files
Image of page 6
7 Getting Your Data into SAS A raw data file has no program associated with it or is associated with a simple editor like Microsoft Notepad A spreadsheet file is not a raw data file EXTERNAL raw data files: data are in an external raw data file use INPUT and INFILE useful with larger files INTERNAL raw data: Data are typed directly into your SAS program use INPUT and DATALINES
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

8 SAS Statements for Reading DATA INPUT: - used to read data; - describes the arrangement of values in the input records and assigns values to SAS variables INFILE : where the data file is located DATALINES: tells SAS where to find the data internally (the data follow) Example: data one; infile “c:\temp\example1”; input a b c $; run;
Image of page 8
9 The Data Step Method A. Reading internal data B. Reading external data /* Reading internal data into SAS */ data one; data two; Input x y z $; infile “c:\temp\example1”; datalines; Input x y z $; 1 2 a Run; 2 5 b ; run; Specify file that contains the data Read data and create 3 variables
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

10 Types of Data Raw data in Standard format: - standard numeric data: contain numerals, decimal points, minus sign, E scientific notation - standard character data: contain letters, numbers, _, &, etc. Examples: Raw data separated by spaces or FREE FORMAT data Raw data arranged in Columns or FIXED FORMAT data Raw data NOT in Standard format: Dates, numbers with embedded commas or dollar signs. (1,000,200).
Image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '07
  • BUNGE
  • Comma-separated values, Delimiter-separated values, Raw image format

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern