STT 305 - Exam 3

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

A typical value for the numeric variable SiteNum is 23,000. Which statement correctly converts the values of SiteNum to character values when creating the variable Location?

Location=dept||'/'||put(sitenum,comma6.);

Within a dataset UNCW.faculty, if BaseSalary is a numerical variable and Bonus is a character variable. What happens when the following program is run? data work.temp; set uncw.faculty; Salary=BaseSalary+Bonus; run;

SAS converts the values of Bonus to numeric values. A message is written to the log

The variable IDCode contains values such as 123BFNCA and 321WMOHB. The 6th and 7th characters identifies State. How do you assign these characters codes to a new variable named State?

State=substr(idcode,6,2);

Which of the following statements is false regarding the program shown below? data work.earnings5; do year=1 to 3; Capital+2000; do quarter=1 to 5; begining=capital; Interest=capital*(0.10/4); capital+interest; output; end; end; run;

The last value for quarter in the new data set is 6.

Suppose the format JOBFMT was created in a FORMAT procedure. Which FORMAT statement applies it to the variable JobTitle in the program output?

format jobtitle jobfmt.;

Which of the following statements store your formats in a permanent catalog?

libname myforlib '/folders/myfolders/stt305'; proc format lib=myforlib; ...;

Suppose you do not specify the LIBRARY= option and your formats are stored in Work.Formats. How long do they exist?

only for the current SAS session

Which keyword can be used to label missing numeric values as well as any values that are not specified in a range?

other

During each execution of the following DO loop, the value of Earned is calculated and is added to its previous value. How many times does this DO loop execute? data work.earnings; Amount=1000; Rate=.075/12; do month=1 to 12; Earned+(amount+earned)*rate; end; run;

12

How many observations will the do loops produce? do year=1 to 3; Capital+2000; do quarter=1 to 5; begining=capital; Interest=capital*(0.10/4); capital+interest; output; end; end;

15

How many times does this DO loop execute in a data step? do year=2 to 16; amount+amount*rate; end;

15

In the data set Work.Invest, what would be the stored value for Year? data work.invest; do year=1990 to 2004; capital+5000; capital+(capital*.10); end; run;

2005

How many characters can be used in a label?

32,767

In the data set Work.earnings5, what would be the stored value for quarter? data work.earnings5; do year=1 to 3; Capital+2000; do quarter=1 to 4; begining=capital; Interest=capital*(0.10/4); capital+interest; output; end; end; run;

5

Which of the following statements is true regarding BY-group processing?

BY variables must be either indexed or sorted.

The variable Team contains values such as BLUE, USA. How do you assign the three-letter country abbreviations to a new variable named Country?

Country=scan(Team,2);

Which keyword, when added to the PROC FORMAT statement, displays all the formats in your catalog?

FMTLIB

The data set Cert.Health includes the following numeric variables. Which is a poor candidate for PROC MEANS analysis?

Hair Color

When you create a format with the VALUE statement, the new format's name cannot end with a number, cannot end with a period, and the name must begin with a dollar sign ($) if used with a character variable. Which of the following is also true?

The name cannot be the name of a SAS format

You can place the FORMAT statement in either a DATA step or a PROC step. What happens when you place it in a DATA step?

You permanently associate the formats with variables.

Which of these statements is false regarding what the ranges in the VALUE statement can specify?

a range of character values, such as 'A'-M. a list of numeric and character values separated by commas, such as 90,'B', 180,'D',270.

Which statement is false regarding DO UNTIL statements? a. The condition is evaluated at the top of the loop, before the enclosed statements are executed. b. The enclosed statements are always executed at least once. c. SAS statements in the DO loop are executed until the specified condition is true. d. The DO loop must have a closing END statement.

a. The condition is evaluated at the top of the loop, before the enclosed statements are executed.

On January 1 of each year, $5,000 is invested in an account. Complete the DATA step below to determine the value of the account after 15 years if a constant interest rate of 10% is expected. a. do count=1 to 15; b. do count=1 to 15 by 10%; c. do count=1 to capital; d. do count=capital to (capital*.10);

a. do count=1 to 15;

Which of the following statements is false regarding the program shown below? data work.invest; do year=1990 to 2004; capital+5000; capital+(capital*.10); output; end; run; a. The OUTPUT statement writes current values to the data set immediately. b. The last value for Year in the new data set is 2005. c. The OUTPUT statement overrides the automatic output at the end of the DATA step. d. The DO loop performs 15 iterations.

b. The last value for Year in the new data set is 2005.

Which of the following would you use to compare the result of investing $4,000 a year for five years in three different banks that compound interest monthly? Assume a fixed rate for the five-year period. a. DO WHILE statement b. nested DO loops c. DO UNTIL statement d. a DO group

b. nested DO loops

By default, PROC FREQ creates a table of frequencies and percentages for which data set variables

both character and numeric variables

Which statement is false regarding the use of DO loops? a. They can contain conditional clauses. b. They can generate multiple observations. c. They can be used to combine DATA and PROC steps. d. They can be used to read data.

c. They can be used to combine DATA and PROC steps.

Frequency distributions work best with variables that contain which types of values?

categorical values

Suppose you need to create the variable FullName by concatenating the values of FirstName, which contains first names, and LastName, which contains last names. What is the best way to remove extra blanks between first names and last names?

data temp; set cert.maillist; length FullName $ 40; fullname=trim(firstname)||' '||lastname; run;

Within the data set UNCW.student, the variable Grade contains values such as freshman, sophomore, junior, senIOR, and others. Which of the following creates a subset of the data in which the values of grade contain the string 'ior'? Make the search for the string case-insensitive.

data temp; set uncw.student; if index(lowcase(grade),'ior') > 0; run;

Within the data set Cert.Bookcase, the variable Finish contains values such as ash, cherry, teak, matte-black. Which of the following creates a subset of the data in which the values of Finish contain the string walnut? Make the search for the string case-insensitive.

data work.bookcase; set cert.bookcase; where index(upcase(finish),'WALNUT') > 0; run;

Because of the growth within the 910 area code, the telephone exchange 210 is being reassigned to the 920 area code. The data set work.temp includes the variable Phone, which contains telephone numbers in the form 910-210-1234. Which of the following programs correctly changes the values of Phone?

data work.temp1(drop=areacode exchange); set work.temp; Areacode=substr(phone,1,3); Exchange=substr(phone,5,3); if areacode='910' and exchange='210' then substr(phone,1,3)='920'; run;

Because of the population growth within the 28403 zip code area, the add-ons (extra 4 digits) 1000 is being reassigned to the 28404 zip code. The data set WILM.zip includes the variable zip code, which contains zip code with add-ons in the form 28401-1234. Which of the following programs correctly changes the values of zipcode?

data work.temp; set WILM.zip; zip=substr(zipcode,1,5); addon=scan(zipcode,2); if zip='28403' and addon='1000' then substr(zipcode,1,5)='28404'; run;

The initial deposit is 8000. Complete the DATA step below to determine the value of the account after 30 months if the nominal interest rate is 10% compound monthly. data payoff; amt=8000; __________; _____________; end; run;

do month=1 to 30; amt=amt*(1+0.1/12);

Select the DO UNTIL statement that would generate the same result as the program below. capital=8000; do while (Capital < 9500); capital+capital*.10/12; month+1; end;

do until (Capital ge 9500);

Which of the following FORMAT procedures is written correctly?

proc format ......; value uncw 1,2 = 'Fresh and sofm' 3 = 'junior' 4 = 'senior'; run; proc format ...; value $uncw 'F','M' = 'Fresh and sofm' 'J' = 'junior' 'S' = 'senior'; run; proc format ; value salary low-<25000='low' 25000-<65000='middle' 65000-high='high'; run; proc format lib=formtlib; value colorfmt 1='Red' 2='Green' 3='Blue'; run;

The default statistics produced by the MEANS procedure are n-count, mean, minimum, maximum, and which one of the following statistics:

standard deviation

A typical value for the character variable Target is 9.725. Which statement correctly converts the values of Target to numeric values when creating the variable TargetNo?

tarn=input(target,5.3);

Which statement limits a PROC MEANS analysis to the variables Boarded, Transfer, and Deplane?

var boarded transfer deplane;

In the following program, complete the statement so that the program stops generating observations when weekday is Friday or when the capital is below 5500. capital=8000; do wd='Mon','Tue','Wed','Thu','Fri' _______________; capital=capital-700; month+1; end;

while (Capital ge 5500)

In the following program, complete the statement so that the program stops generating observations when Distance reaches 250 miles or when 10 gallons of fuel have been used.

while(Distance<=250)


Set pelajaran terkait

Chapter 42 Circulation and Gas Exchange

View Set

Healthcare professionals (Metabolic Syndrome and Related Conditions)

View Set

copy Ethical Hacking and Network Defense Chpt 4-6

View Set

Corporate Social Responsibility and Citizenship - Chapter 3

View Set

Principles of Investment Test: Chapters 6&7.

View Set