Chapter 5,17 and 18 Interview Question
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
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.
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=.