STAT 480 Final Exam

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

True or False. At the beginning of each iteration of the DATA step, each user-defined variable is set to missing.

true

Given the following SAS statement: hosp = int(subj/10000); What is the value of hosp if subj = 410112?

41 410112/10000 = 41.0112. Therefore, int(41.0112) is the integer portion of 41.0112, or simply 41.

The output from the PRINT procedure should look something like this: Obs subj v_date gender weight height 1 11 01/04/06 1 120 60 2 12 02/05/06 1 140 64 3 13 02/03/06 170 63 4 14 02/05/06 2 200 70 5 15 02/14/06 2 215 68

False

True or false. The data step debugger is launched when the following program is submitted.

False

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 The empty title statement that precedes the second PRINT procedure cancels the previous title statement.

Given the following SAS statement: LIBNAME vanilla 'C:\icecream\flavors'; which of the following statements is false?

The directory C:\icecream\flavors is permanently associated with the libref vanilla

How many of the following values are valid values for a numeric variable? 102 $1.02 1.02E2 -29 +32.2

The dollar sign ($) is the only symbol in the values displayed that is not valid for a numeric value.

The following INPUT statement would also read the data successfully: input subj 2. +1 v_date mmddyy8. +1 gender $1. +1 weight 3. +1 height 2.;

True

The following assignment statement is a valid SAS statement fahrenheit = (9*celsius)/5 + 32;

True

The very first line of the SAS program: /**** SAS program: Q0101.sas ****/ is a valid SAS comment.

True

he following if-then-else statement contains a set of mutually exclusive conditions: if (85 < M <= 90) then level = 1; else if (90 < M <= 95) then level = 2; else if (95 < M <= 100) then level = 3; else if (100 < M <= 105) then level = 4; else if (105 < M <= 110) then level = 5; else if (110 < M <= 115) then level = 6;

True For each observation one and only one condition holds. Another way to look at it is that the intervals don't overlap.

Which of the following is not created during the compilation phase?

data portion of the data set

When reading raw data into a SAS data set, which of the following is not used during the execution phase unless specifically requested?

data step debugger

Which one of the following types of log messages typically causes SAS to stop processing a DATA step?

error

Which one of the following is not a required variable in a SAS dataset that is to be used for a codebook?

format

Which of the following is a valid if-then-else statement?

if (100 LE total LT 150) then total = total + 10;

Which of the following INPUT functions correctly converts values stored in the character variable price to numeric values?

input(price, dollar6.2); The general form of the INPUT function is input(source, informat);

Unless otherwise directed, the DATA step executes:

once for each record in the input data file

Which of the following best describes the data set that results upon running the SAS data step in this program?

permanent SAS data set

Which of the following is not a valid SAS statement?

a + b = c;

How many observations and variables does the above data set contain?

3 observations, 4 variables The four variables are Store, Units, Price and Week.

Which of the following best describes the name pef1 that appears in the program?

a numeric variable

SAS stores a subject number beginning with 0, say 007, as the number 7 in a numeric variable, say subj. 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.

Suppose the grades.dat data file contains 32 rows of data. If the following program is run, how many observations does the school data set contain? DATA school; infile 'c:\grades.dat' OBS = 4; input student $ g1 g2 g3 final; RUN;

4

What is the value of _N_ when the following DATA step stops execution? DATA temps; input town $ degF; DATALINES; Lancaster 36 Hershey 34 State College 32 ; RUN;

4 SAS stops executing the DATA step when it gets beyond the end of the input data file. At that point, the automatic variable _N_ is 1 more than the number of rows of input data.

If the following PRINT procedure is applied to the skin data set, how many columns (including the observation number) does the procedure print? PROC PRINT data = skin; id state; var lat long mort; RUN;

4 The ID statement suppresses the printing of the observation number. Therefore, there are four columns -- one for each of the following variables: state, lat, long, mort.

Not counting the header rows, how many rows does the report produced by the following set of code contain? PROC REPORT DATA = boats NOWINDOWS HEADLINE; COLUMN Name Port Locomotion Type; RUN;

10 All of the variables that appear in the COLUMN statement are character variables. Therefore, SAS produces a detail report with one row for each observation in the data set. Since there are 10 rows in the data set, the report contains 10 rows.

What is the value SAS assigns to the variable avgsales for store 13 if avgsales is determined by the following statement: avgsales = mean(M, T, W, R, F);

100

f the following PRINT procedure is applied to the skin data set, what is the total number of columns (cols, including the observation number) and observations (obs) printed? That is, what is cols + obs? PROC PRINT data=skin (OBS=5); RUN;

11 Since there is no var statement, SAS prints all of the variables (5), plus an observation number. The OBS = option tells SAS to print just the first 5 observations. Therefore the total is 5 variables + 1 observation number column + 5 observations = 11.

For which stores does SAS assign the value "WOW" to the variable status if status is determined by the following statement: if (F GT 140) then status = 'WOW'; else status = 'Work harder!';

12

For which store does SAS assign the value "YUCK" to the variable status if status is determined by the following statement: if (M LE 105) and (T GE 135) then status = "YUCK";

12 The AND operator requires both conditions to be true. The only store for which both M < 105 and T >= 135 is store 12.

What is the value SAS assigns to the variable avgsales for store 11 if avgsales is determined by the following statement avgsales = round(mean(M,T,W,R,F),1);

120

What is the value SAS assigns to the variable newvar for store 15 if newvar is determined by the following statement: newvar = M + T - W + (R - F);

125

For which stores does SAS assign the value "Work harder!" to the variable status if status is determined by the following statement: if (R LT 110) then status = 'Work harder!'; else status = 'WOW';

13 Don't forget that the missing value is deemed less than any number, and therefore you should always program for missing values.

For which store does SAS assign the value "Cool!" to the variable status if status is determined by the following statement: if (M GT F) or (R GT T) then status = 'Cool!';

15 Either the value of M has to be greater than the value of F or the value of R has to be greater than the value of T. The only store that meets either of these criteria is store 14.

How many variables does the data set permanent contain?

2 The input statement contains two variable names, and therefore the data set contains two variables.

If the following PRINT procedure is applied to the skin data set, what is the total number of observations printed? PROC PRINT data=skin; where ocean = 1; RUN;

22

If the following PRINT procedure is applied to the skin data set, what is the value of the sum that SAS calculates? PROC PRINT data=skin; sum ocean; RUN;

22

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 one of the following group processing statements produced the following PROC MEANS output? The MEANS Procedure Analysis Variable : Museums N Type Region Obs Sum ------------------------------------------ NM East 2 2 West 2 3 NP East 2 8 West 5 20 ------------------------------------------

A CLASS statement produces a single large table, whereas BY-group processing creates a series of small tables. The order of the variables in the CLASS statement determines their order in the output report. class Type Region;

Which of the following items are contained in the descriptor portion of a SAS data set?

A) number of observations and variables B) date and time the data set was created

Librefs remain in effect until:

A) you change them B) you cancel them C) you end your SAS session *All of the above*

Upon executing the following code, which one of the following statements is false? 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;

An observation number is printed for each observation. The ID statement tells SAS to replace the observation number with the region variable.

True or false. In order for the following code to execute properly, the schools data set must be sorted by region. PROC MEANS data = schools; by region; var tuition; RUN;

Any time you process a data set BY a particular variable, the data set must be sorted by that variable. True

Not counting the header rows, how many rows does the report produced by the following set of code contain? PROC REPORT DATA = boats NOWINDOWS HEADLINE; COLUMN Price; RUN;

Because the only variable, Price, that appears in the COLUMN statement is numeric, SAS simply sums the variable to create a one-line report. 1

In the report produced by the following code, what is the value SAS displays under the column labeled Price? PROC REPORT DATA = boats NOWINDOWS HEADLINE; COLUMN Price; RUN;

Because the only variable, Price, that appears in the COLUMN statement is numeric, SAS simply sums the variable. 390.83, the sum of the price values

As a result of executing the following code, which one of the following temporary data sets does SAS print? PROC MEANS data = schools; by region; var tuition; output out = summary min = mintuit max = maxtuit n = n; RUN; PROC PRINT; RUN;

Because there is no data set specified in the PROC PRINT statement, SAS prints the most recent data set. The most recent data set is summary as it is created by the MEANS procedure's OUTPUT statement. summary

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?

Code C: PROC CONTENTS data = stat480 varnum; RUN;

Based on the following code, the variable color is converted from numeric to character: PROC FORMAT; value colorfmt 1 = 'Red' 2 = 'White' 3 = 'Blue'; RUN; DATA flag; set flag; format color colorfmt.; RUN;

Customized formats do not alter variable types. False

The INFILE statement is in its proper location in the DATA step.

False

In general, which of the following SAS programming constructs is used to read data into SAS

Data Step

The SAS data set temp contains four variables called a, b, c, and d. Which one of the following data steps correctly reads the data from temp into another data set called stat480?

Data Step D: DATA stat480; set temp; RUN;

The lines printed by the CONTENTS procedure will be no longer than 80 characters.

False

True or false. The following code: PROC FORMAT; value sexfmt 1 = 'male' 2 = 'female'; RUN; DATA gender; sex = 1; RUN; PROC PRINT data = gender; RUN; produces output that looks like this: Obs sex 1 male

Feedback: The sex variable is never associated with the sexfmt format. Therefore, SAS would not know to display a 1 as male. False

The columns in the raw data file that follows are defined as: Columns 1-3 is subject number Columns 4-5 is height Columns 6-8 is initial weight Columns 9-11 is ending weight

INPUT @1 subj 3. @4 height 2. @6 wght1 3. @9 wght2 3

Which one of the following statements will limit a PROC MEANS analysis to the variables Tuition, Fees, and Cost?

In general, a VAR statement tell SAS which variables to analyze. var Tuition Fees Cost;

True or false. Ignoring any differences in the headings of the output, the following two sets of code generate identical reports. Set A: PROC MEANS data = schools min max; var Tuition Fees Cost; RUN; Set B: PROC SUMMARY data = schools min max; var Tuition Fees Cost; RUN;

In order for the SUMMARY procedure to produce a printed report, you have to specify the PRINT option. False

True or false. The CNTLIN= option of the FORMAT procedure tells SAS to print the contents of the temporary formats catalog.

It is the FMTLIB option of the FORMAT procedure that tells SAS to print the contents of the temporary formats catalog. False

If the following PRINT procedure is applied to the skin data set, what is the heading for the variable Lat? PROC PRINT data = skin SPLIT='*'; label lat = 'Latitude*(Degrees N)'; var state lat long mort;

Latitude (Degrees N) The split character (*) tells SAS to place the heading across two lines.

Which of the following windows is where you should look after running any SAS program to make sure that SAS didn't encounter any subtle errors?

Log Window

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 SAS cannot convert the character value 10,000 to a numeric value because it contains a comma. Therefore, total is assigned a missing value.

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 (.) For addition by definition, SAS assigns a missing value to those observations which have missing values.

Which of the following OPTIONS tells SAS to let a SAS data set be used without access to its permanent formats catalog?

NOFMTERR

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;

None of the above The variable is region, but the label statement tells SAS to display it as Region.

Which of the following are valid PUT statements?

PUT 'My data error'; PUT _ALL_; PUT _N_= _ERROR_=;

How many columns does the report produced by the following set of code contain? PROC REPORT DATA = boats NOWINDOWS HEADLINE; COLUMN Port Locomotion Price; DEFINE Port / group; DEFINE Locomotion / across; DEFINE Price / mean; RUN;

Port generates one column, Price generates one column, and Locomotion generates two columns, since it has two possible values and is defined as an across variable. 4

Which of the following best describes how the variable Price is used in the report generated by this code? PROC REPORT DATA = boats NOWINDOWS HEADLINE; COLUMN Name Price TaxedPrice; DEFINE Name / 'Boat Name'; DEFINE Price / center; DEFINE TaxedPrice / computed; compute TaxedPrice; TaxedPrice = 1.08*Price.Sum; endcomp; RUN;

Price is a numeric variable. Since no specific usage is defined for it, SAS uses it as an analysis variable. analysis

How many columns does the report produced by the following set of code contain? PROC REPORT DATA = boats NOWINDOWS HEADLINE; COLUMN Name Port Locomotion Type; DEFINE Name / display 'Boat Name'; DEFINE Port / display center; RUN;

Since four variables appear in the COLUMN statement, and they are all character variables treated as display variables by default, the report contains four columns. 4

Upon executing the following SAS code, what is the first state to appear in the resulting report? PROC SORT data = skin out = srtdskin; by descending mort; RUN; PROC PRINT data = srtdskin; RUN;

Texas The descending option in the SORT procedure tells SAS to sort the data set by mort from largest to smallest. Since Texas has the largest mort value, it appears first in the report.

The informat BIPARTY defined by the following FORMAT procedure: PROC FORMAT; invalue $biparty '1'='Dem' '2'='Rep'; RUN; is output to a permanent formats catalog.

The "LIBRARY=" option would need to be used in order to create a permanent formats catalog.

Based on the following format procedure: PROC FORMAT; value gradefmt LOW-<11 = '1' 11-<70 = '2' 70-<85 = '3' 85-HIGH = '4'; RUN; if the variable grade is associated with the format gradefmt, what value would SAS print when it encountered a grade of 11?

The < symbol means "not including." Therefore, here for example, LOW-<11 means "all grades below 11, but not including 11."

Not counting the header rows, how many rows does the report produced by the following set of code contain? PROC REPORT DATA = boats NOWINDOWS HEADLINE; COLUMN Locomotion Type Price; DEFINE Locomotion / GROUP; DEFINE Type / GROUP; RUN;

The GROUP option tells SAS to create a row for each unique value of the variable. Looking at the data, for power, there are two types (cat and yac), and for sail, there are three types (cat, sch, and yac) ... therefore SAS displays five rows in total. To convince yourself of this further, you might want to run the SAS code yourself. 5

Suppose you run a program that causes two DATA step errors. What is the value of the automatic variable _ERROR_ when SAS displays an error message in the log window for the second error?

The _ERROR_ variable equals 0 when there is no error, and it equals 1 when there is an error. It doesn't matter how many errors occurred in the DATA step. 1

Which of the following best describes what happens if you submit the following program? PROC PRINT data = skin; by ocean; var state lat long mort; RUN;

The code generates errors and stops processing. Because the skin data set is not sorted by ocean, an error is generated and SAS stops processing the code.

Which of the following statements are true when you define an order variable in the REPORT procedure?

The detail rows are ordered according to their formatted values. The REPORT procedure displays only the first occurrence of each order variable value in a set of rows that have the same value for all order variables. You can't create summary reports.

If the data set schools contains four variables, how many columns does the report generated by the following code contain? PROC MEANS data = schools min max; RUN;

The fact that the data set contains four variables is again irrelevant here. As a result of the two statistics keywords in the PROC MEANS statement, SAS calculates 2 summary statistics. Add the column with the variable names and you get 3 columns. 3

If the data set schools contains four variables, how many columns does the report generated by the following code contain? PROC MEANS data = schools; RUN;

The fact that the data set contains four variables is irrelevant here. By default, SAS calculates 5 summary statistics. Add the column with the variable names and you get 6 columns. 6

If the data set schools contains four variables, how many rows of summary statistics does the report generated by the following code contain? (Do not count report headings or formatting, just the rows of summary statistics.) PROC MEANS data = schools; RUN;

The fact that the data set contains four variables tells us that there will be four rows in the report ... one for each variable. 4

Upon executing the following code, how many variables are contained in the summary data set? PROC MEANS data = schools; by region; var tuition; output out = summary min = mintuit max = maxtuit n = n; RUN;

The six variables are region, mintuit, maxtuit, and n, and the two additional _TYPE_ and _FREQ_. 6

Which of the following do you not need to tell SAS when reading data into a SAS data set?

The size of the data set you're reading in

What does the third column in the report produced by the following code contain? PROC REPORT DATA = boats NOWINDOWS HEADLINE; COLUMN Locomotion Type Price; DEFINE Locomotion / GROUP; DEFINE Type / GROUP; DEFINE Price / Mean; RUN;

The third column contains the PRICE variable, and the define statement for Price tells SAS to generate the Mean price. Mean Price

How many columns does the report produced by the following set of code contain? PROC REPORT DATA = boats NOWINDOWS HEADLINE; COLUMN Name Price TaxedPrice; DEFINE Name / 'Boat Name'; DEFINE Price / center; DEFINE TaxedPrice / computed; compute TaxedPrice; TaxedPrice = 1.08*Price.Sum; endcomp; RUN;

The three variables are name, price, and taxedprice.

How many of the following names are valid SAS variable names? supercalifragilisticexpialidocious super bowl disease _temp*F 2temp

The variable disease is the only valid name.

If the variable student is associated with the following picture format: picture studpix OTHER = '00-000'; how would SAS display the student value 05678?

Using 00-000 tells SAS to suppress leading zeroes. Therefore, 05678 is printed as 5-678.

If the variable ssn is associated with the following picture format: picture ssnpix LOW-HIGH = '999-99-9999' (prefix ='#'); how would SAS display the ssn value 012345678?

Using 999-99-9999 tells SAS to print leading zeroes. The picture format does not have a placeholder for the # sign. therefore, 012-34-5678 is the answer. If the picture format were instead 0999-99-9999, then #012-34-5678 is the correct answer.

What is the name of the SAS data set created by the following data step? DATA _NULL_; set green; file 'c:\grass.dat'; put seed water sun; RUN;

When _NULL_ is used, SAS executes the data step as if it were creating a new SAS data set, but no observations and no variables are written to an output data set. No SAS data set is created.

What type of variable is the variable Store in the above data set?

character

What style of input is used to read the data into the SAS data set?

list input

What is the value of status for store 13 if status is determined by the following SAS statement: if R < 100 then status = 'low'; else if R >= 100 then status = 'high'; else if R = . then status = 'missing';

low

What is the value of status for store 13 if status is determined by the following SAS statement: if R < 100 then status = 'low'; else status = 'high';

low

For which of the following values of the variable gender is the following condition true: if gender = 'male' then ...;

male

Which one of the following summary statistics is not produced by the MEANS procedure by default?

median

What is the value of status for store 13 if status is determined by the following SAS statement: if T EQ . then status = 'missing'; else if T LT 100 then status = 'low'; else status = 'high;

missing

Which of the following best describes the data set that results upon running the SAS data step in this program?

temporary SAS datastep The data set name appearing in the DATA step is a one-level name. Therefore, the data set that is created is temporary.


Set pelajaran terkait

Papanikolla - NCLEX Management of Care

View Set

Ethics and Prof Practice: Study Guide for Final Exam

View Set

GSU Film 2700 final exam review 3

View Set

The Muscular System: Contraction of Whole Muscle

View Set

Hematology (Dynamic Quiz Questions)

View Set

vSim Pediatrics | Jackson Weber (Neuro, Epilepsy)

View Set

PNE 105 Chapter 46: Caring for Clients with Disorders of the Lower GI Tract. Med-Surg.

View Set

AD BANKER AL P&C CH 1 GENERAL INSURANCE

View Set