Access and Create Data Structures Flashcards

1
Q

Data types in SAS

A

Two data types; Numeric and Character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A dot (.) represents

A

Missing Data value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

SAS is case-sensitive. True or False?

A

False. SAS is case-insensitive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

DATA step

A

DATA steps are used to Create datasets, data, Read and Modify the data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

PROC step

A

PROC step is used for processing data created by DATA step. Data is processed by analyzing data, performing utility functions, printing reports.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Statements that indicate the end of step

A

run; quit; stop; abort; or Encountering a new statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

SASHELP

A

It is a library that contains information that controls your SAS session along with sample SAS data sets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

SASUSER

A

It is a library that stores any information regarding changes to the default settings for the SAS windowing environment. You can also store SAS data sets, SAS programs, and other SAS files in the SASUSER library

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

WORK library

A

It is the temporary storage location for datasets. It is the default library that SAS places datasets created without a specified library. These files are temporary and are deleted at the end of the session.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

DATALINES

A

It is a statement used in DATA step to enter rows of raw data. The data is terminated by a semi-colon. The DATALINES statement should be the last statement in the DATA step. CARDS statement can also be used instead of DATALINES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

INFILE

A

It is used to tell SAS the filename and location. The INFILE statement must follow the DATA statement and precede the INPUT statement.
INFILE ‘C:\MyDir\Desktop\Home\users.dat’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

LRECL

A

LRECL expanded as Longest Record Length, is as the name suggests the longest record length in a data file. It used to specify the length of a record. A record is one row(also referred to as observation) in the data file.
INFILE ‘location\user.txt’ LRECL = 2000;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The Dollar sign ($) besides a variable indicates…

A

that the variable is of character data type.

INPUT streetName $ streetNumber;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

TITLE

A

The TITLE statement tells SAS to put the text enclosed in quotation marks on the top of each page of output. Without this statement, SAS would put the words “The SAS System” at the top of each page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

LENGTH

A

It is used to define the length of the values of a variable. The default length of a variable is 8. Using LENGTH, you are able to define any length between 1 and 32,767.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Informats

A

Informats are used to tell SAS how to interpret the data. They are useful when dealing with non-standard data. There are 3 types of Informats; Character, numeric, and date.

17
Q

Formatted inputs

A

Using Informats such as character($informatw.), numeric(informatw.d), and date(informatw.) where w is the width and d is the number of decimal places.

18
Q

INPUT Name $16. +1 Age 3. ;

What does ‘+1’ mean here?

A

‘+1’ is used to skip over a column

19
Q

Different between @ and @n

A

@n is a column pointer

20
Q

Difference between @ and @@ in INPUT statement

A

@ and @@ are both line-hold specifiers.
@ is used when you want to impose a condition onto the raw data line. When SAS reaches the end of the observation, based on the IF condition, SAS decides whether or not to keep the observation.
@@ is used when there is more than one observation in a line. @@ tells SAS that the observation has ended and the next observation starts.

21
Q

INPUT statement options

A

FIRSTOBS = n; tells SAS at what line to begin reading data.
OBS = n; tells SAS to read n number of raw data lines.
MISSOVER; SAS automatically reads a new line of raw data if there are still variables in the observation that don’t have an assigned value. Using MISSOVER, SAS assigns missing values for these types of variables.
TRUNCOVER;

22
Q

DELIMITER= or DLM=

A

It is an option INFILE statement that helps SAS read data from files with other delimiters. The default delimiter when SAS reads data is space. The delimiter is specified as the option value in single quotes. If delimiter is a string of characters, DLMSTR= is used.

23
Q

ASCII value for tab delimiter. DLM=?

A

DLM = ‘90’X is used for tab delimiters

24
Q

DSD option

A

It is expanded as Delimiter-Sensitive Data.
DSD assumes delimiter is comma if DLM= option is not assigned.
DSD ignores delimiters embedded in a data value if it is enclosed with quotation marks. Quotation marks are not read as a part of the data value.
By default, SAS interprets two delimiters as a single delimiter. Hence when reading data with missing values, the DSD option is used in INFILE.
It is common to use DSD along with MISSOVER in cases where SAS might read new observation data if the last value is missing.

25
Q

IMPORT procedure

A

PROC IMPORT scans your data file (the first
20 rows by default) and automatically determine the variable types (character or numeric)
It will assign lengths to the character variables and can recognize some date formats.
It treats two consecutive delimiters in the data file as a missing value, will read values enclosed by quotation marks, and assign missing values to variables when it runs out of data on a line.
It is also possible to use the first line in your data file for the variable names