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

Chapter 5,17 and 18 Interview Question

The document discusses various topics related to reading data from external files into SAS, including: 1) The main difference between reading an existing SAS data set and an external file is that SAS retains variable values between observations for a data set, but must redeclare variables when reading an external file. 2) To read an external file into SAS, use the INFILE statement to specify the file path and the INPUT statement to read variables into a SAS dataset. 3) Special input delimiters in SAS include DLM and DSD, which treat consecutive delimiters as missing values and remove quotation marks from character values.

Uploaded by

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

Chapter 5,17 and 18 Interview Question

The document discusses various topics related to reading data from external files into SAS, including: 1) The main difference between reading an existing SAS data set and an external file is that SAS retains variable values between observations for a data set, but must redeclare variables when reading an external file. 2) To read an external file into SAS, use the INFILE statement to specify the file path and the INPUT statement to read variables into a SAS dataset. 3) Special input delimiters in SAS include DLM and DSD, which treat consecutive delimiters as missing values and remove quotation marks from character values.

Uploaded by

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

1

Chapter 5,17 and 18 interview question

What is the difference between reading data from an external file and
reading data from an existing data set?
The main difference is that while reading an existing data set with the SET
statement, SAS retains the values of the variables from one observation to the
next. Whereas when reading the data from an external file, only the
observations are read. The variables will have to re-declared if they need to be
used.
How Will You Read An Input File Into Sas?
Use the statements INFILE to point to the file reference(should be defined using
Filename) / to the file path. Use INPUT statement to read the data into the sas
dataset.
What is the difference between VAR B1 – B3 and VAR B1 -- B3?
A single dash specifies the consecutively numbered variables. A double dash
specifies the variables available within the data set.
Example:
Data Set: ID NAME B1 B2 C1 B3
B1 – B3 would return B1 B2 B3
B1– B3 would return B1 B2 C1 B3

What are the special Input Delimiters?


Input delimiters are DLM and DSD.

Difference between INPUT and INFILE


INFILE statement is used to identify an external file
INPUT statement is used to describe your variables

FILENAME TEST 'C:\DEEP\File1.xls';


DATA READIN;
2

INFILE TEST;
LENGTH NAME $25;
INPUT ID NAME$ SEX;
RUN;

Note : The variable name, followed by $ (dollar sign), idenfities the variable
type as character. In the example shown above, ID and SEX are numeric
variables and Name a character variable.

How you can read the variables that you need?


You read the variables using input statement with column /line pointers,
informats and length specifiers.

How SAS treats the DSD delimiters?


When you define DSD, SAS treats two consecutive delimiters as a missing
value and removes quotation marks from character values.

What are the special input delimiters used in SAS?


Special input delimiters used in SAS are DLM and DSD.

What is the good SAS programming practices for processing large data
sets?
The good SAS programming practices for processing large data sets is to sort
them once using firstobs= and obs=.

How you can read the variables that you need?


You read the variables using input statement with column /line pointers,
informats and length specifiers.
3

How will you generate test data with no input data?


You will generate test data with no input data using “put” statement and “Data
Null”.

What is DATA _NULL_?


The DATA _NULL_ is mainly used to create macro variables. It can also be
used to write output without creating a dataset. The idea of "null" here is that we
have a data step that actually doesn't create a physical SAS data set.

What is a PUT statement?


A PUT statement is a flexible tool in data step programming.
Examples of a PUT statement are:
PUT _all_ – writes the values of all variables
PUT 132*’_’ – writes 132 underscores
PUT one two three – writes three variable values separated by a space.

You might also like