SAS Base Programmer Practice Exam Verified
Questions, Correct Answers, and Detailed
Explanations for Computer Science Students||Already
Graded A+
1. What is the default file extension for a SAS data set?
A) .sas
B) .txt
C) .sas7bdat
D) .csv
The .sas7bdat extension is used for SAS data sets stored in the SAS
library.
2. Which procedure is used to display the contents of a SAS data
set?
A) PROC PRINT
B) PROC CONTENTS
C) PROC MEANS
D) PROC SORT
PROC CONTENTS provides metadata about the data set including
variable types, lengths, and labels.
3. Which statement is used to create a new SAS data set?
A) DATA SET
B) DATA
C) PROC DATA
D) CREATE
The DATA statement begins a DATA step to create a new data set.
,4. What is the default length of a numeric variable in SAS?
A) 4 bytes
B) 6 bytes
C) 8 bytes
D) 10 bytes
SAS stores numeric variables in 8 bytes by default, which allows for
large precision numbers.
5. Which function returns the number of characters in a character
variable?
A) SUBSTR
B) INDEX
C) LENGTH
D) COMPRESS
The LENGTH function counts all characters in a string, including
spaces.
6. What does the OBS= data set option do?
A) Filters variables
B) Limits the number of observations read
C) Deletes observations
D) Sorts data
OBS= allows you to specify the number of observations to read from a
SAS data set.
7. Which statement writes observations to the SAS log during
execution?
A) PUTLOG
B) LOG
C) PUT
, D) PRINT
PUT writes values to the log, and PUTLOG is an optional variation.
8. How can you concatenate two SAS data sets vertically?
A) MERGE statement
B) JOIN statement
C) SET statement
D) APPEND statement
The SET statement stacks datasets one after another in a DATA step.
9. What is the purpose of a FORMAT statement in SAS?
A) Creates new variables
B) Controls the display of variable values
C) Deletes observations
D) Sorts data
FORMAT specifies how values are displayed in output without
changing the underlying data.
10. Which function extracts a substring from a character variable?
A) LENGTH
B) TRIM
C) SUBSTR
D) SCAN
SUBSTR(variable, start, length) extracts a substring starting at the
specified position.
11. Which SAS procedure calculates descriptive statistics such as
mean and standard deviation?
A) PROC PRINT
B) PROC FREQ
Questions, Correct Answers, and Detailed
Explanations for Computer Science Students||Already
Graded A+
1. What is the default file extension for a SAS data set?
A) .sas
B) .txt
C) .sas7bdat
D) .csv
The .sas7bdat extension is used for SAS data sets stored in the SAS
library.
2. Which procedure is used to display the contents of a SAS data
set?
A) PROC PRINT
B) PROC CONTENTS
C) PROC MEANS
D) PROC SORT
PROC CONTENTS provides metadata about the data set including
variable types, lengths, and labels.
3. Which statement is used to create a new SAS data set?
A) DATA SET
B) DATA
C) PROC DATA
D) CREATE
The DATA statement begins a DATA step to create a new data set.
,4. What is the default length of a numeric variable in SAS?
A) 4 bytes
B) 6 bytes
C) 8 bytes
D) 10 bytes
SAS stores numeric variables in 8 bytes by default, which allows for
large precision numbers.
5. Which function returns the number of characters in a character
variable?
A) SUBSTR
B) INDEX
C) LENGTH
D) COMPRESS
The LENGTH function counts all characters in a string, including
spaces.
6. What does the OBS= data set option do?
A) Filters variables
B) Limits the number of observations read
C) Deletes observations
D) Sorts data
OBS= allows you to specify the number of observations to read from a
SAS data set.
7. Which statement writes observations to the SAS log during
execution?
A) PUTLOG
B) LOG
C) PUT
, D) PRINT
PUT writes values to the log, and PUTLOG is an optional variation.
8. How can you concatenate two SAS data sets vertically?
A) MERGE statement
B) JOIN statement
C) SET statement
D) APPEND statement
The SET statement stacks datasets one after another in a DATA step.
9. What is the purpose of a FORMAT statement in SAS?
A) Creates new variables
B) Controls the display of variable values
C) Deletes observations
D) Sorts data
FORMAT specifies how values are displayed in output without
changing the underlying data.
10. Which function extracts a substring from a character variable?
A) LENGTH
B) TRIM
C) SUBSTR
D) SCAN
SUBSTR(variable, start, length) extracts a substring starting at the
specified position.
11. Which SAS procedure calculates descriptive statistics such as
mean and standard deviation?
A) PROC PRINT
B) PROC FREQ