Ch:2 Basic Concepts Flashcards
How many observations and variables does the data set below contain? Name Sex age Picker M 32 Fletcher 28 Romano F . Choi M 42
a. 3 observations, 4 variables b. 3 observations, 3 variables c. 4 observations, 3 variables d. cannot tell because some values are missing
Correct answer: c
Rows in the data set are called observations, and columns are called variables. Missing values do not affect the structure of the data set.
How many program steps are executed when the program below is processed? data user.tables; set work.jobs;run; proc sort data=user.tables; by name; run; proc print data=user.tables; run; a. three b. four c. five d. six
Correct answer: a
When it encounters a DATA, PROC, or RUN statement, SAS stops reading statements and executes the previous step in the program. This program contains one DATA step and two PROC steps, for a total of three program steps.
What type of variable is the variable AcctNum in the data set below? AcctNum Gender 3456_1 M 2451_2 Romano F Choi M
a. numeric b. character c. can be either character or numeric d. cannot tell from the data shown
Correct answer: b
It must be a character variable, because the values contain letters and underscores, which are not valid characters for numeric values.
What type of variable is the variable Wear based on the justification of the text in the data set below? Brand Wear Acme 43 Ajax 34 Atlas .
a. numeric b. character c. can be either character or numeric d. cannot tell from the data shown
Correct answer: a
It must be a numeric variable, because the missing value is indicated by a period rather than by a blank. Missing values in numeric variables are indicated by a period while character values are indicated by a blank. Numeric values are also right justified while character values are left justified.
With the system option VALIDVARNAME=ANY, which of the following variable names is valid? a. 4BirthDate b. $Cost c. Tax-Rate d. all of the above
Correct answer: d
If you use VALIDVARNAME=ANY, the name can begin with or contain any characters, including blanks, national characters, special characters, and multi-byte characters. The name can be up to 32 bytes long. The name must contain at least one character, and the variable name can contain mixed-case letters.
Which of the following files is a permanent SAS file? a. Work.PrdSale b. Cert.MySales c. Certxl.Quarter1 d. b and c only e. a, b, and c
Correct answer: d
To store a file permanently in a SAS data library, you assign it a libref. For example, by assigning the libref Cert to a SAS data library, you specify that files within the library are to be stored until you delete them. Therefore, SAS files in the Cert and Certxl libraries are permanent files.
In a DATA step, how can you reference a temporary SAS data set named Forecast? a. Forecast b. Work.Forecast c. Sales.Forecast (after assigning the libref Sales) d. a and b only
Correct answer: d
To reference a temporary SAS file in a DATA step or PROC step, you can specify the one-level name of the file (for example, Forecast) or the two-level name using the libref Work (for example, Work.Forecast).
What is the default length for the numeric variable Balance?
Name Balance Adams 105.73 Geller 107.89 Martinez 97.45 Noble 182.50
a. 5
b. 6
c. 7
d. 8
Correct answer: d
The numeric variable Balance has a default length of 8. Numeric values (no matter how many digits they contain) are stored in 8 bytes of storage unless you specify a different length.
How many statements does the following SAS program contain? proc print data=cert.admit label double; var ID Name Sex Age; where Sex=F; label Sex='Gender'; run; a.three b.four c.five d.six
Correct answer: c
The five statements are 1) the PROC PRINT statement (two lines long); 2) the VAR statement; 3) the WHERE statement (on the same line as the VAR statement); 4) the LABEL statement; and 5) the RUN statement (on the same line as the LABEL statement).
What is a SAS library?
a. a collection of SAS files, such as SAS data sets and catalogs
b. in some operating environments, a physical collection of SAS files
c. a group of SAS files in the same folder or directory
d. all of the above
Correct answer: d
Every SAS file is stored in a SAS library. A SAS library is a collection of SAS files, such as SAS data sets and catalogs. In some operating environments, a SAS library is a physical collection of files. In others, the files are only logically related. In the Windows and UNIX environments, a SAS library is typically a group of SAS files in the same folder or directory.