程序代写代做代考 Excel More on

More on
Reading Data
into SAS
STAT 342 – Fall 2020 Tutorial – 4

Objectives
• Importing raw data with a mix of column and formatted input
• Importing raw data with a mix of named and other input
methods
• To learn how to import raw data with Headers
• Importing data from XML and Excel files
• Optionsin“INFILE”Statement

Mix of Column and Formatted Input Styles
Objective is to know that we can use mix of one or more input methods import data into SAS environment

Mix of Named and other input methods
• If we begin with named input any variable that follows should be inputted with named input
Named and List/Column Input Together
Named and Formatted Input Together
• What to do if data contain both named and non named valued?

Reading Data with Headers

Importing Data from Excel Files
Instead of infile
Format of data Name of the If want to file data set replace existing
data file

Importing Data from XML Files
Extensible Markup Language (XML) files are really just plain text files that use custom tags to describe the structure and other features of the document.
Advantages of using XML files:
• Platform / programming language independent
• Supports Unicode
• Easy to change saved data etc.

Options in INFILE Statement
Infile “path to data source” DLM= DSD MISSOVER FIRSTOBS= OBS= ;
• CSV: dlm=‘ , ’
• TAB: dlm=‘ 09 ’x
• SPACE: dlm=‘ ‘
2 Functions,
1) Two consecutive delimiters will be
considered as missing data (e.g. 40,
,50)
2) Allows specify custom delimiter
If 2 first line will be considered as the header
within DLM=
Number of lines to be read from the data file
This option prevents SAS from going to a new input line if it does not find values for all of the variables in the current line of data