0% found this document useful (0 votes)
49 views3 pages

Class - 2-Done: Today's Topics

The document discusses various methods for reading data in SAS including list, column, format, nixed, named, and flowover methods. It also covers the INFILE statement for reading external files regularly, with delimiters, and specifying observation ranges with FIRSTOBS and OBS. SET statements are used to access libraries and libname creates temporary libraries. Key points include using DLM for delimiters, DSD with TRUNCOVER to read observations that don't contain all variables, and FIRSTOBS and OBS to specify a range of observations. The document provides examples and syntax for these various data reading methods in SAS.

Uploaded by

Raj Blore Mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views3 pages

Class - 2-Done: Today's Topics

The document discusses various methods for reading data in SAS including list, column, format, nixed, named, and flowover methods. It also covers the INFILE statement for reading external files regularly, with delimiters, and specifying observation ranges with FIRSTOBS and OBS. SET statements are used to access libraries and libname creates temporary libraries. Key points include using DLM for delimiters, DSD with TRUNCOVER to read observations that don't contain all variables, and FIRSTOBS and OBS to specify a range of observations. The document provides examples and syntax for these various data reading methods in SAS.

Uploaded by

Raj Blore Mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Class - 2-Done

Tuesday, March 18, 2014


10:30 AM

Today's Topics:

Methods for reading data

List method

Column method

Format method

Nixed method

Named method

Flowover method

Double trail (@@) method

Column repetition

INFILE statement - Regular,

INFILE statement- with DLM

INFILE statement- with DSD OBS & FIRST OBS

SET statement

Library creation
Pic's
Lecture Topic:

Methods for reading data through DATALINES

Method

Type

List

A standard method that accepts only 8 characters or 12 digits


while accepting the data. And data

Column

To read data with a definite space between every variable input name $1-16

Format

To read data even when it is not having definite space


&-to
consider
space

Syntax

name &:$25.

:25.- to read with max 25


$-characters
characters. And by giving : it
says consider any char length
between 1 to 25. otherwise it
will allocate total 25 character
space

Nixed

Use both format & column method

As mentioned

Named

To read data in any order

name= $

Flowover

SAS starts taking inputs even if it is not available in particular


record
SAS will ignore reading after getting input for last variable is
complete

Ex:
datalines;
123
45678
9 10

11 12 13 14
Out come
A
B
C
1
2
3
4
5
6
9 10
11
Double trail
(@@)

To avoid blanks while taking input for all variables and go to


next observation and take data to fill

input a b c @@

INFILE statements
Type

Use

Syntax

Regular

To read database from an external file

INFILE '<File path>

DLM

can avoid special characters by declaring them as


delimiters while reading the data

INFILE '<File path>


DLM=',@#';

DSD /
When observations don't consists of inputs for all
INFILE '<File path>
TRUNCOVER
variables, we use DSD with missover / truncover
DSD TRUNCOVER
OBS & FIRSTOBS
Also another syntax for considering observations from FIRSTOBS=4 OBS=
our choice.
OBS & FIRSTOBS FIRSTOBS = from which Observation, we need to start
reading first observation.
OBS = how many no. of observations we want to read

SET Statement - to recall database from existing libraries


Syntax :- SET SASUSER.ADMIT;

Library creation :- to store all output tables / data generated from program
execution for that particular session
Syntax :- libname <Temp library name of our choice> '<Folder path to
store all output files>';
Difference between TRUNCOVER & MISSOVER:
o
MiSSOVER : Even after using this, if the last variable length is not
matching to variable declaration then It will consider as last variable input
is missing
o
TRUNCOVER : It is as advanced option, and it will read even if it is not
matching with last variable length

Summary / IMP Points

Abbreviations

DLM - Delimiter
DSD - Delimit Sensitive Data
OBS - Observation

Study Questions
Homework:
Sachin V
English A
XAVIER
SAURAV VI
Maths B
JPSEPH
Read the data in
Variables:
1.Name
2.Standard
3.Subject
4.Division
5.School
1st query: to read entire data for all variables
2nd query: to read partial data. i.e. only variables Name, Division & School
Interview questions:
What if I want random observations
What if I want even series out or odd services out
What if want every 3rd record or 4th record.
Without opening the table, how will I know what is there in the last row.
Without opening the table, how to see what is there in the last 10 records.

You might also like