Lessons 1-6 Exam
true of false: /***************SAS program: Q0101.sas **********/ is a valid SAS comment
true
Given the following SAS statement: hosp = int(subj/10000); what is the value of 'hosp' if subj = 410112
41.0112
To correctly read data from one data set (called temp) into another data set (called stat480): The data set you are reading from should appear in the ____ statement and the data you are creating should appear in the _____ statement
SET DATA
Upon executing the following code, what is the heading of the first column to appear in the printed output? PROC PRINT data=summary double split='/'; id region; where region ne .; format quarter date7.; label region='Region' n='Sample / Size' maxtuit = 'Maximum / Tuition' mintuit = 'Minimum / Tuition'; title 'The summary data set'; RUN; a. region b. Sample Size c. Maximum Tuition d. Minimum Tuition e. None of the above
e.
True or false. The second report that is generated as a result of executing the following code is titled "Skin Cancer Mortality by State". PROC PRINT data = skin; title 'Skin Cancer Mortality by State'; var state lat mort; RUN; title; PROC PRINT data = skin; var state long mort; RUN;
false
true or false: an INPUT statement is needed with a SET statement
false
true or false: the 'infile' statement is in the correct location DATA acrn.lung; input subj $ a b c d; infile 'C:\acrn.lung\spiro.dat'; RUN;
false
True or false: the lines printed by the CONTENTS procedure will be no longer than 80 characters OPTIONS PS=58 LS=80 CENTER; DATA lung; input subj $ fev1 ffc pef1; infile 'c:\acrn\data\spiro.dat'; RUN; PROC PRINT data=lung; RUN; OPTIONS PS=60 LS=90; PROC CONTENTS data=lung; RUN;
false because the second OPTIONS statement overrides the first
Answer the following question using this data set: DATA back; input @1 subj 2. +1 v_date mmddyy8. +1 gender $1. +1 weight 3. +1 height 2.; ; RUN; PROC PRINT data=back; RUN; True or false: the output from the PRINT procedure would look something like this: Obs subj v_date gender weight height 1 11 01/04/06 1 120 60
false because there is no FORMAT statement
What style of input is used to read the following data into the SAS data set: input subj 2. +1 v_date mmddyy8. +1 gender $1. +1 weight 3. +1 height 2.;
formatted input
which of the following items are contained in the descriptor portion of a SAS data set
number of observations and variables and the date and time the data set was created
What type of variable is the variable 'store' Store Units Price Week A 320 1.29 1 B 249 1.39 . 481 1.09 1
Character variable
SAS stores a subject number beginning with 0, say 007, as the number 7 in a numeric variable, say subj. (INPUT @subj 3.) What informat would you need to specify if you wanted SAS to store the three digit subject number 007 as a character variable subj instead?
$3.
How many of the following names are valid SAS variable names? supercalifragilisticexpialidocious disease _temp*F 2temp
1 the variable disease if the only valid name because of the character limit, begins with character, no special characters
how many columns (including the observation number) does this procedure print? PROC PRINT data = skin; id state; var lat long mort; RUN;
4
How many observations and variables does this data set contain? Store Units Price Week A 320 1.29 1 B 249 1.39 . 481 1.09 1
4 variables and 3 observations
How many of the following values are valid values for a numeric variable 102 $1.02 1.02E2 -29 +32.2
4 the dollar sign is the ONLY symbol in the values displayed that is not valid for numeric value
How many variables does the data set 'permnent' contain? LIBNAME stat480 'c:\stat480\data'; DATA permnent; input subj 1-4 gender $ 6; DATALINES; 1102 1 10 32 1103 2 21 69 1104 2 34 80 ; RUN; PROC PRINT data = permnent; RUN;
2
Store M T W R F 11 94 130 120 115 140 12 105 135 125 115 145 13 90 . 100 . 110 14 100 130 120 112 140 15 115 100 105 110 95 What is the value SAS assigns to the variable M for store 13 if M is determined by the following statement: M = M - 10;
80
Which of the following is not a valid SAS statement and why a. a + b = c; b. avg1 = mean(x1, x2, x3); c. avg2 = (x1 + x2 + x3)/3; d. F = 1.8 * C + 32;
a because it is an assignment statement. the variable must always appear to the left of the equal sign and the expression must always appear to the right of the equal sign
For which of the following values of the variable gender is the following condition true: if gender = 'male' then ...; a. MALE b. male c. MaLe d. FEMALE e. female
b.
which of the following best describes the data set that results upon running the SAS data step in this program, if the libref name is : DATA acrn.lung; a. raw ascii data file b. permanent SAS data set c. temporary SAS data set d. binary data file
b.
Which of the following INPUT functions correctly converts values stored in the character variable 'price' to numeric values? a. input(price); b. input(dollar6.2, price); c. input(price, dollar6.2); d. None of the above
c.
Which of the following do you not need to tell SAS when reading data into a SAS data set? a. the kind of SAS data set that you want to create b. the format of the data c. the size of the data set you're reading in d. where your input data are located
c.
Which of the following is a valid if-then-else statement? a. if total = 140 then status EQ 'works'; b. if total < 140 then status = 'won't work'; c. if (100 LE total LT 150) then total = total + 10; d. if total 140 then status = 'fails';
c.
Which of the following pieces of code allows you to view information about the descriptor portion of a SAS data set called stat480 with the variables being displayed by the order of their creation? a. PROC CONTENTS data = stat480._ALL_ nods; RUN; b. PROC CONTENTS data = stat480; RUN; c. PROC CONTENTS data = stat480 varnum; RUN;
c.
Which one of the following data steps correctly reads the data form "temp" into another data set called "stat 480"? a. DATA temp; set stat480; RUN; b. DATA stat480; set temp; input a b c d; RUN; c. DATA stat480; set temp; RUN;
c.
For if-then statements, SAS treats values in quotes as being:
case-sensitive
Given the following SAS statement: LIBNAME vanilla 'C:\icecream\flavors'; which of the following statements is false? a. Work is the name of a SAS library b. the SAS data sets appearing in the library called vanilla are stored permanently c. vanilla is the name of SAS library d. the directory C:\icecream\flavors is permanently associated with the libref vanilla
d
Librefs remains in effect until: a. you change them b. you cancel them c. you end your SAS session d. all of the above
d.
What style of input is used to read the data into the SAS dat set: DATA lung; input subj $ fev1 ffc pef1; infile 'c:\acrn\data\spiro.dat'; RUN;
list input
the variable names appear with no special column or formatting instructions for which style of input
list input
If a value of the CHARACTER variable subtotal equals: 10,000 what is the value of the NUMERIC variable total if it is calculated as follows? total = subtotal + 325;
missing value
Store M T W R F 11 94 130 120 115 140 12 105 135 125 115 145 13 90 . 100 . 110 14 100 130 120 112 140 15 115 100 105 110 95 What is the value SAS assigns to the variable total for store 13 if total is determined by the following statement: total = M + T + W + R + F;
missing value
All SAS statements must end with which of the following punctuation marks
semi-colon (;)
True or false: the following assignment statement is a valid SAS statement: fahrenheit = (9*celsius)/5 + 32;
true
what statement must the INFILE statement precede?
the INPUT statement
in general, which of the following SAS programming constructs is used to read data into SAS
the data step
where should you look after running any SAS program to make sure that SAS didn't encounter any subtle errors
the log window