Stats 124 Final Review

Description

SAS Basic Programming Multiple Choice
James Blair
Quiz by James Blair, updated more than 1 year ago
James Blair
Created by James Blair about 10 years ago
289
0

Resource summary

Question 1

Question
See image
Answer
  • 3 Observations, 4 Variables
  • 3 Observations, 3 Variables
  • 4 Observations, 3 Variables
  • Can't tell because some values are missing

Question 2

Question
How many program steps are executed when the program below is processed? data user.tables; infile jobs; input date name $ job $; run; proc sort data = user.tables; by name; run; proc print data = user.tables; run; SAS Institute (2011-08-08). SAS Certification Prep Guide: Base Programming for SAS 9, Third Edition (Kindle Locations 13475-13478). SAS Institute/SAS Publishing. Kindle Edition.
Answer
  • three
  • four
  • five
  • six

Question 3

Question
See Image
Answer
  • numeric
  • character
  • can be either character or numeric
  • can't tell from the data shown

Question 4

Question
See image
Answer
  • numeric
  • character
  • can be either character or numeric
  • can't tell from the data shown

Question 5

Question
Which of the following variable names is valid
Answer
  • 4BirthDate
  • $Cost
  • _Items_
  • Tax-Rate

Question 6

Question
Which of the following files is a permanent SAS file?
Answer
  • Sashelp.PrdSale
  • Sasuser.MySales
  • Profits.Quarter1
  • all the above

Question 7

Question
In a DATA step, how can you reference a temporary SAS data set named Forecast?
Answer
  • Forecast
  • Work.Forecast
  • Sales.Forecast (after assigning the liberef Sales)
  • A and B

Question 8

Question
See image
Answer
  • 5
  • 6
  • 7
  • 8

Question 9

Question
How many statements does the following SAS program contain? proc print data = new.prodsale label double; var state day price1 price2; where state =' NC'; label state =' Name of State'; run;
Answer
  • three
  • four
  • five
  • six

Question 10

Question
What is a SAS library?
Answer
  • collection of SAS files, such as SAS data sets and catalogs
  • in some operating environments, a physical collection of SAS files
  • a group of SAS files in the same folder or directory.
  • all the above

Question 11

Question
If you submit the following program, how does the output look? options pagesize = 55 nonumber; proc tabulate data = clinic.admit; class actlevel; var age height weight; table actlevel, ( age height weight)* mean; run; options linesize = 80; proc means data = clinic.heart min max maxdec = 1; var arterial heart cardiac urinary; class survive sex; run;
Answer
  • The PROC MEANS output has a print line width of 80 characters, but the PROC TABULATE output has no print line width.
  • The PROC TABULATE output has no page numbers, but the PROC MEANS output has page numbers
  • Each page of output from both PROC steps is 55 lines long and has no page numbers, and the PROC MEANS output has a print line width of 80 characters.
  • The date does not appear on output from either PROC step.

Question 12

Question
How can you create SAS output in HTML format on any SAS platform?
Answer
  • by specifying system options
  • by using programming statements
  • by using SAS windows to specify the result format
  • you can't create HTML output on all SAS platforms

Question 13

Question
In order for the date values 05May1955 and 04Mar2046 to be read correctly, what value must the YEARCUTOFF = option have?
Answer
  • A value between 1947 and 1954, inclusive
  • 1955 of higher
  • 1946 or higher
  • any value

Question 14

Question
When you specify an engine for a library, you always specify
Answer
  • the file format for files that are stored in the library
  • the version of SAS you are using
  • access to other software vendors' files
  • instructions for creating temporary SAS files

Question 15

Question
Which statement prints a summary of all the files stored in the library named Area51?
Answer
  • proc contents data=Area51._all_ nods;
  • proc contents data=Area51 _all_ nods;
  • proc contents data=Area51 _all_ noobs
  • proc contents data=Area51 _all_.nods;

Question 16

Question
See image.
Answer
  • OBS=, DATE, and NONUMBER
  • NUMBER, PAGENO=1, and DATE
  • NUMBER and DATE only
  • none of the above

Question 17

Question
Which of the following programs correctly references a SAS data set named SalesAnalysis that is stored in a permanent SAS library?
Answer
  • data saleslibrary.salesanalysis; set mydata.quarter1sales; if sales > 100000; run;
  • data mysales.totals; set sales_99. salesanalysis; if totalsales > 50000; run;
  • aproc print data = salesanalysis.quarter1; var sales salesrep month; run;
  • proc freq data = 1999data.salesanalysis; t ables quarter* sales; run;

Question 18

Question
Which time span is used to interpret two-digit year values if the YEARCUTOFF = option is set to 1950?
Answer
  • 1950-2049
  • 1950-2050
  • 1949-2050
  • 1950-2000

Question 19

Question
Assuming you are using SAS code and not special SAS windows, which one of the following statements is false?
Answer
  • LIBNAME statements can be stored with a SAS program to reference the SAS library automatically when you submit the program.
  • When you delete a libref, SAS no longer has access to the files in the library. However, the contents of the library still exist on your operating system.
  • Librefs can last from one SAS session to another.
  • You can access files that were created with other vendors' software by submitting a LIBNAME statement.

Question 20

Question
What does the following statement do? libname osiris spss 'c:\ myfiles\ sasdata\ data.spss';
Answer
  • defines a library called Spss using the OSIRIS engine
  • defines a library called Osiris using the SPSS engine
  • defines two libraries called Osiris and Spss using the default engine
  • defines the default library using the OSIRIS and SPSS engines

Question 21

Question
As you write and edit SAS programs it's a good idea to
Answer
  • begin DATA and PROC steps in column one
  • indent statements within a step
  • begin RUN statements in column one
  • all the above

Question 22

Question
Suppose you have submitted a SAS program that contains spelling errors. Which set of steps should you perform, in the order shown, to revise and resubmit the program?
Answer
  • Correct the errors. Clear the Log window. Resubmit the program. Check the Log window.
  • Correct the errors. Resubmit the program. Check the Output window. Check the Log window.
  • Correct the Errors. Clear the Log window. Resubmit the program. Check the Output window.
  • Correct the errors. Clear the Output window. Resubmit the program. Check the Output window.

Question 23

Question
What happens if you submit the following program? proc sort data = clinic.stress out = maxrates; by maxhr; run; proc print data = maxrates label double noobs; label rechr =' Recovery Heart Rate; var resthr maxhr rechr date; where toler =' I' and resthr > 90; sum fee; run;
Answer
  • Log messages indicate that the program ran successfully
  • A “PROC SORT running” message appears at the top of the active window, and a log message may indicate an error in a statement that seems to be valid.
  • A log message indicates that an option is not valid or not recognized.
  • A “PROC PRINT running” message appears at the top of the active window, and a log message may indicate that a quoted string has become too long or that the statement is ambiguous.

Question 24

Question
What generally happens when a syntax error is detected?
Answer
  • SAS continues processing the step
  • SAS continues to process the step, and the Log window displays messages about the error
  • SAS stops processing the step in which the error occurred and the Log window displays messages about the error
  • SAS stops processing the step in which the error occurred, and the Output window displays messages about the error.

Question 25

Question
A syntax error occurs when
Answer
  • Some data values are not appropriate for the SAS statements that are specified in a program.
  • the form of the elements in a SAS statement is correct, but the elements are not valid for that usage.
  • program statements do not conform to the rules of the SAS language.
  • none of the above

Question 26

Question
How can you tell whether you have specified an invalid option in a SAS program?
Answer
  • A log message indicates an error in a statement that seems to be valid.
  • A log message indicates that an option is not valid or not recognized.
  • The message “PROC running” or “DATA step running” appears at the top of the active window.
  • You can't tell until you view the output from the program.

Question 27

Question
Which of the following programs contains a syntax error?
Answer
  • proc sort data = sasuser.mysales; by region; run;
  • dat sasuser.mysales; set mydata.sales99; run;
  • proc print data = sasuser.mysales label; label region =' Sales Region'; run;
  • none of the above

Question 28

Question
What should you do after submitting the following program in the Windows or UNIX operating environment? proc print data = mysales; where state =' NC; run;
Answer
  • Submit a RUN statement to complete the PROC step.
  • Recall the program. Then add a quotation mark and resubmit the corrected program.
  • Cancel the submitted statements. Then recall the program, add a quotation mark, and resubmit the corrected program
  • Recall the program. Then replace the invalid option and resubmit the corrected program.

Question 29

Question
Which of the following commands opens a file in the code editing window?
Answer
  • file 'd:\ programs\ sas\ newprog.sas'
  • include 'd:\ programs\ sas\ newprog.sas'
  • open 'd:\ programs\ sas\ newprog.sas'
  • all of the above

Question 30

Question
Suppose you submit a short, simple DATA step. If the active window displays the message “DATA step running” for a long time, what probably happened?
Answer
  • You misspelled a keyword
  • You forgot to end the DATA step with a RUN statement
  • You specified an invalid data set option
  • Some data values weren't appropriate for the SAS statements that you specified.

Question 31

Question
See image
Answer
  • proc print data = flights.laguardia noobs; var on changed flight; where on > = 160; run;
  • proc print data = flights.laguardia; var date on changed flight; where changed > 3; run;
  • proc print data = flights.laguardia label; id date; var boarded transferred flight; label boarded =' On' transferred =' Changed'; where flight =' 219'; run;
  • proc print flights.laguardia noobs; id date; var date on changed flight; where flight =' 219'; run;

Question 32

Question
Which of the following PROC PRINT steps is correct if labels are not stored with the data set?
Answer
  • proc print data = allsales.totals label; label region8 =' Region 8 Yearly Totals'; run;
  • proc print data = allsales.totals; label region8 =' Region 8 Yearly Totals'; run;
  • proc print data allsales.totals label noobs; run;
  • proc print allsales.totals label; run;

Question 33

Question
Which of the following statements selects from a data set only those observations for which the value of the variable Style is RANCH, SPLIT, or TWOSTORY?
Answer
  • where style =' RANCH' or 'SPLIT' or 'TWOSTORY';
  • where style in 'RANCH' or 'SPLIT' or 'TWOSTORY';
  • where style in (RANCH, SPLIT, TWOSTORY);
  • where style in (' RANCH',' SPLIT',' TWOSTORY');

Question 34

Question
If you want to sort your data and create a temporary data set named Calc to store the sorted data, which of the following steps should you submit?
Answer
  • proc sort data = work.calc out = finance.dividend; run;
  • proc sort dividend out = calc; by account; run;
  • proc sort data = finance.dividend out = work.calc; by account; run;
  • proc sort from finance.dividend to calc; by account; run;

Question 35

Question
See image.
Answer
  • the DATE system option and the LABEL option in PROC PRINT
  • the DATE and NONUMBER system options and the DOUBLE and NOOBS options in PROC PRINT
  • the DATE and NONUMBER system options and the DOUBLE option in PROC PRINT
  • the DATE and NONUMBER system options and the NOOBS option in PROC PRINT

Question 36

Question
Which of the following statements can you use in a PROC PRINT step to create this output?
Answer
  • var month instructors; sum instructors aerclass walkjogrun swim;
  • var month; sum instructors aerclass walkjogrun swim;
  • var month instructors aerclass; sum instructors aerclass walkjogrun swim;
  • all the above

Question 37

Question
What happens if you submit the following program? proc sort data = clinic.diabetes; run; proc print data = clinic.diabetes; var age height weight pulse; where sex =' F'; run
Answer
  • The PROC PRINT step runs successfully, printing observations in their sorted order.
  • The PROC SORT step permanently sorts the input data set.
  • The PROC SORT step generates errors and stops processing, but the PROC PRINT step runs successfully, printing observations in their original (unsorted) order.
  • The PROC SORT step runs successfully, but the PROC PRINT step generates errors and stops processing.

Question 38

Question
If you submit the following program, which output does it create? proc sort data = finance.loans out = work.loans; by months amount; run; proc print data = work.loans noobs; var months; sum amount payment; where months < 360; run;
Answer

Question 39

Question
Choose the statement below that selects rows in which the amount is less than or equal to $ 5000 the account is 101-1092 or the rate equals 0.095.
Answer
  • where amount < = 5000 and account =' 101-1092' or rate = 0.095;
  • where (amount le 5000 and account =' 101-1092') or rate = 0.095;
  • where amount < = 5000 and (account =' 101-1092' or rate eq 0.095);
  • where amount < = 5000 or account =' 101-1092' and rate = 0.095;

Question 40

Question
What does PROC PRINT display by default?
Answer
  • PROC PRINT does not create a default report; you must specify the rows and columns to be displayed.
  • PROC PRINT displays all observations and variables in the data set. If you want an additional column for observation numbers, you can request it.
  • PROC PRINT displays columns in the following order: a column for observation numbers, all character variables, and all numeric variables.
  • PROC PRINT displays all observations and variables in the data set, a column for observation numbers on the far left, and variables in the order in which they occur in the data set.

Question 41

Question
Which SAS statement associates the fileref Crime with the raw data file C:\ States\ Data\Crime.dat?
Answer
  • filename crime 'c:\ states\ data\ crime.dat';
  • filename crime c:\ states\ data\ crime.dat;
  • fileref crime 'c:\ states\ data\ crime.dat';
  • filename 'c:\ states\ data\ crime' crime.dat;

Question 42

Question
Filerefs remain in effect until . . .
Answer
  • You change them
  • You cancel them
  • you end your SAS session
  • all the above

Question 43

Question
Which statement identifies a raw data file to be read with the fileref Products and specifies that the DATA step read only records 1-15?
Answer
  • infile products obs 15;
  • infile products obs = 15;
  • input products obs = 15;
  • input products 1-15;

Question 44

Question
Which of the following programs correctly writes the observations from the data set below to a raw data file?
Answer
  • data _null_; set work.patients; infile 'c:\ clinic\ patients\ referals.dat'; input id 1-4 sex 6 age 8-9 height 11-12 weight 14-16 pulse 18-20; run;
  • data referals.dat; set work.patients; input id 1-4 sex 6 age 8-9 height 11-12 weight 14-16 pulse 18-20; run;
  • data _null_; set work.patients; file c:\ clinic\ patients\ referals.dat; put id 1-4 sex 6 age 8-9 height 11-12 weight 14-16 pulse 18-20; run;
  • data _null_; set work.patients; file 'c:\ clinic\ patients\ referals.dat'; put id 1-4 sex 6 age 8-9 height 11-12 weight 14-16 pulse 18-20; run;

Question 45

Question
Which raw data file can be read using column input?
Answer

Question 46

Question
See image
Answer
  • data work.salesrep; infile empdata; input ID $ 1-4 LastName $ 6-12 FirstName $ 14-18 City $ 20-29; run; proc print data = work.salesrep; run;
  • data work.salesrep; infile empdata; input ID $ 1-4 Name $ 6-12 FirstName $ 14-18 City $ 20-29; run; proc print data = work.salesrep; run;
  • data work.salesrep; infile empdata; input ID $ 1-4 name1 $ 6-12 name2 $ 14-18 City $ 20-29; run; proc print data = work.salesrep; run;
  • All the above

Question 47

Question
See image
Answer
  • input StockNumber $ 1-3 Finish $ 5-9 Style $ 11-18 Item $ 20-24 Price 27-32;
  • input StockNumber $ 1-3 Price 27-32 Item $ 20-24 Finish $ 5-9 Style $ 11-18;
  • input $ StockNumber 1-3 Price 27-32 $ Item 20-24 $ Finish 5-9 $ Style 11-18;
  • input StockNumber $ 1-3 Price $ 27-32 Item $ 20-24 Finish $ 5-9 Style $ 11-18;

Question 48

Question
Which statement correctly re-defines the values of the variable Income as 100 percent higher?
Answer
  • income = income* 1.00;
  • income = income +( income* 2.00);
  • income = income* 2;
  • income =* 2;

Question 49

Question
Which program correctly reads instream data?
Answer
  • data finance.newloan; input datalines; if country =' JAPAN'; MonthAvg = amount/ 12; 1998 US CARS 194324.12 1998 US TRUCKS 142290.30 1998 CANADA CARS 10483.44 1998 CANADA TRUCKS 93543.64 1998 MEXICO CARS 22500.57 1998 MEXICO TRUCKS 10098.88 1998 JAPAN CARS 15066.43 1998 JAPAN TRUCKS 40700.34 ;
  • data finance.newloan; input Year 1-4 Country $ 6-11 Vehicle $ 13-18 Amount 20-28; if country =' JAPAN'; MonthAvg = amount/ 12; datalines; run;
  • data finance.newloan; input Year 1-4 Country 6-11 Vehicle 13-18 Amount 20-28; if country =' JAPAN'; MonthAvg = amount/ 12; datalines; 1998 US CARS 194324.12 1998 US TRUCKS 142290.30 1998 CANADA CARS 10483.44 1998 CANADA TRUCKS 93543.64 1998 MEXICO CARS 22500.57 1998 MEXICO TRUCKS 10098.88 1998 JAPAN CARS 15066.43 1998 JAPAN TRUCKS 40700.34 ;
  • data finance.newloan; input Year 1-4 Country $ 6-11 Vehicle $ 13-18 Amount 20-28; if country =' JAPAN'; MonthAvg = amount/ 12; datalines; 1998 US CARS 194324.12 1998 US TRUCKS 142290.30 1998 CANADA CARS 10483.44 1998 CANADA TRUCKS 93543.64 1998 MEXICO CARS 22500.57 1998 MEXICO TRUCKS 10098.88 1998 JAPAN CARS 15066.43 1998 JAPAN TRUCKS 40700.34 ;

Question 50

Question
Which SAS statement subsets the raw data shown below so that only the observations in which Sex (in the second field) has a value of F are processed?
Answer
  • if sex = f;
  • if sex = F;
  • if sex =' F';
  • a or b

Question 51

Question
Which of the following is not created during the compilation phase?
Answer
  • a. the data set descriptor
  • b. the first observation
  • c. the program data vector
  • d. the _N_and_ERROR_ automatic variables

Question 52

Question
During the compilation phase, SAS scans each statement in the DATA step, looking for syntax errors. Which of the following is not considered a syntax error?
Answer
  • a. incorrect values and formats
  • b. invalid options or variable names
  • c. missing or invalid punctuation
  • d. missing or misspelled keywords

Question 53

Question
Unless otherwise directed, the DATA step executes...
Answer
  • a. once for each compilation phase.
  • b. once for each DATA step statement
  • c. once for each record in the input file
  • d. once for each variable in the input file

Question 54

Question
At the beginning of the execution phase, the value of _N_ is 1, the value of _ERROR_ is 0, and the values of the remaining variables are set to:
Answer
  • a. 0
  • b. 1
  • c. undefined
  • d. missing

Question 55

Question
Suppose you run a program that causes three DATA errors. What is the value of the automatic variable _ERROR_ when the observation that contains the third error is processed?
Answer
  • a. 0
  • b. 1
  • c. 2
  • d. 3

Question 56

Question
Which of the following actions occurs at the beginning of an iteration of the DATA step?
Answer
  • a. The automatic variables _N_ and _ERROR_ are incremented by one.
  • b. The DATA step stops execution.
  • c. The descriptor portion of the data set is written.
  • d. The values of variables created in programming statements are re-set to missing in the program data vector.

Question 57

Question
Based on the DATA step shown below, in what order will the variables be stored in the new data set? data perm.update; infile invent; input IDnum $ Item $ 1-13 Instock 21-22 BackOrd 24-25; Total = instock + backord; run;
Answer
  • a. IDnum Item InStock BackOrd Total
  • b. Item IDnum InStock BackOrd Total
  • c. Total IDnum Item InStock BackOrd
  • d. Total Item IDnum InStock BackOrd

Question 58

Question
If SAS detects syntax errors, then...
Answer
  • a. data set variables will contain missing values.
  • b. the DATA step does not compile.
  • c. the DATA step still compiles, but it does not execute.
  • d. the DATA step still compiles and executes.

Question 59

Question
What is wrong with this program? data perm.update; infile invent input Item $ 1-13 IDnum $ 15-19 Instock 21-22 BackOrd 24-25; total = instock + backord; run;
Answer
  • a. missing semicolon on second line
  • b. missing semicolon on third line
  • c. incorrect order of variables
  • d. incorrect variable type

Question 60

Question
See image
Answer
  • a. A keyword was misspelled in the DATA step.
  • b. A semicolon was missing from the INFILE statement.
  • c. A variable was misspelled in the INPUT statement.
  • d. A dollar sign was missing in the INPUT statement.

Question 61

Question
If you don't specify the LIBRARY = option on the PROC FORMAT statement, your formats are stored in Work.Formats, and they exist ...
Answer
  • a. only for the current procedure.
  • b. only for the current DATA step.
  • c. only for the current SAS session.
  • d. permanently.

Question 62

Question
Which of the following statements will store your formats in a permanent catalog?
Answer
  • a. libname library 'c:\ sas\ formats\ lib'; proc format lib = library ...;
  • b. libname library 'c:\ sas\ formats\ lib'; format lib = library ...;
  • c. library =' c:\ sas\ formats\ lib'; proc format library ...;
  • d. library =' c:\ sas\ formats\ lib'; proc library ...;

Question 63

Question
When creating a format with the VALUE statement, the new format's name -cannot end with a number -cannot end with a period -cannot be the name of a SAS format, and...
Answer
  • a. cannot be the name of a data set variable.
  • b. must be at least two characters long.
  • c. must be at least eight characters long.
  • d. must begin with a dollar sign ($) if used with a character variable.

Question 64

Question
Which of the following FORMAT procedures is written correctly?
Answer
  • a. proc format lib = library value colorfmt; 1 =' Red' 2 =' Green' 3 =' Blue' run;
  • b. proc format lib = library; value colorfmt 1 =' Red' 2 =' Green' 3 =' Blue'; run;
  • c. proc format lib = library; value colorfmt; 1 =' Red' 2 =' Green' 3 =' Blue' run;
  • d. proc format lib = library; value colorfmt 1 =' Red'; 2 =' Green'; 3 =' Blue'; run;

Question 65

Question
Which of these is false? Ranges in the VALUE statement can specify...
Answer
  • a. a single value, such as 24 or 'S'.
  • b. a range of numeric values, such as 0-1500.
  • c. a range of character values, such as 'A'-' M'.
  • d. a list of numeric and character values separated by commas, such as 90,' B', 180,' D', 270.

Question 66

Question
How many characters can be used in a label?
Answer
  • a. 40
  • b. 96
  • c. 200
  • d. 256

Question 67

Question
Which keyword can be used to label missing numeric values as well as any values that are not specified in a range?
Answer
  • a. LOW
  • b. MISS
  • c. MISSING
  • d. OTHER

Question 68

Question
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?
Answer
  • a. You temporarily associate the formats with variables.
  • b. You permanently associate the formats with variables.
  • c. You replace the original data with the format labels.
  • d. You make the formats available to other data sets.

Question 69

Question
The format JOBFMT was created in a FORMAT procedure. Which FORMAT statement will apply it to the variable JobTitle in the program output?
Answer
  • a. format jobtitle jobfmt;
  • b. format jobtitle jobfmt.;
  • c. format jobtitle = jobfmt;
  • d. format jobtitle =' jobfmt';

Question 70

Question
Which keyword, when added to the PROC FORMAT statement, will display all the formats in your catalog?
Answer
  • a. CATALOG
  • b. LISTFMT
  • c. FMTCAT
  • d. FMTLIB

Question 71

Question
The default statistics produced by the MEANS procedure are n, mean, minimum, maximum, and...
Answer
  • a. median
  • b. range
  • c. standard deviation
  • d. standard error of the mean.

Question 72

Question
Which statement will limit a PROC MEANS analysis to the variables Boarded, Transfer, and Deplane?
Answer
  • a. by boarded transfer deplane;
  • b. class boarded transfer deplane;
  • c. output boarded transfer deplane;
  • d. var boarded transfer deplane;

Question 73

Question
The data set Survey.Health includes the following variables. Which is a poor candidate for PROC MEANS analysis?
Answer
  • a. IDnum
  • b. Age
  • c. Height
  • d. Weight

Question 74

Question
Which of the following statements is true regarding BY group processing?
Answer
  • a. BY variables must be either indexed or sorted.
  • b. Summary statistics are computed for BY variables.
  • c. BY group processing is preferred when you are categorizing data that contains few variables.
  • d. BY group processing overwrites your data set with the newly grouped observations.

Question 75

Question
Which group processing statement produced the PROC MEANS output shown below?
Answer
  • a. class sex survive;
  • b. class survive sex;
  • c. by sex survive;
  • d. by survive sex;

Question 76

Question
Which program can be used to create the following output?
Answer
  • a. proc means data = clinic.diabetes; var age height weight; class sex; output out = work.sum_gender mean = AvgAge AvgHeight AvgWeight; run;
  • b. proc summary data = clinic.diabetes print; var age height weight; class sex; output out = work.sum_gender mean = AvgAge AvgHeight AvgWeight; run;
  • c. proc means data = clinic.diabetes noprint; var age height weight; class sex; output out = work.sum_gender mean = AvgAge AvgHeight AvgWeight; run;
  • d. Both a and b.

Question 77

Question
By default, PROC FREQ creates a table of frequencies and percentages for which data set variables?
Answer
  • a. character variables
  • b. numeric variables
  • c. both character and numeric variables
  • d. none: variables must always be specified

Question 78

Question
Frequency distributions work best with variables that contain
Answer
  • a. continuous values.
  • b. numeric values.
  • c. categorical values.
  • d. unique values.

Question 79

Question
Which PROC FREQ step produced this two-way table?
Answer
  • a. proc freq data = clinic.diabetes; tables height weight;format height htfmt. weight wtfmt.; run;
  • b. proc freq data = clinic.diabetes; tables weight height; format weight wtfmt. height htfmt.; run;
  • c. proc freq data = clinic.diabetes; tables height* weight; format height htfmt. weight wtfmt.; run;
  • d. proc freq data = clinic.diabetes; tables weight* height; format weight wtfmt. height htfmt.; run;

Question 80

Question
Which PROC FREQ step produced this table?
Answer
  • a. proc freq data = clinic.diabetes; tables sex weight / list; format weight wtfmt.; run;
  • b. proc freq data = clinic.diabetes; tables sex* weight / nocol; format weight wtfmt.; run;
  • c. proc freq data = clinic.diabetes; tables sex weight / norow nocol; format weight wtfmt.; run;
  • d. proc freq data = clinic.diabetes; tables sex* weight / nofreq norow nocol; format weight wtfmt.; run;

Question 81

Question
Using ODS statements, how many types of output can you generate at once?
Answer
  • a. 1 (only HTML output)
  • b. 2
  • c. 3
  • d. as many as you want

Question 82

Question
If ODS is set to its default settings in the SAS windowing environment for Microsoft Windows and UNIX, , what types of output are created by the code below? ods html file =' c:\ myhtml.htm'; ods pdf file =' c:\ mypdf.pdf';
Answer
  • a. HTML and PDF
  • b. PDF only
  • c. HTML, PDF, and listing
  • d. No output is created because ODS is closed by default.

Question 83

Question
In the SAS windowing environment for Microsoft Windows and UNIX, what is the purpose of closing the HTML destination in the code shown below? ods html close; ods rtf ... ;
Answer
  • a. It conserves system resources.
  • b. It simplifies your program.
  • c. It makes your program compatible with other hardware platforms.
  • d. It makes your program compatible with previous versions of SAS.

Question 84

Question
When the code shown below is run, what will the file D:\ Output\ body.html contain? ods html body =' d:\ output\ body.html'; proc print data = work.alpha; run; proc print data = work.beta; run; ods html close;
Answer
  • a. The PROC PRINT output for Work.Alpha.
  • b. The PROC PRINT output for Work.Beta.
  • c. The PROC PRINT output for both Work.Alpha and Work.Beta.
  • d. Nothing. No output will be written to D:\ Output\body.html.

Question 85

Question
When the code shown below is run, what file will be referenced by the links in D:\ Output\contents.html? ods html body =' d:\ output\ body.html' contents =' d:\ output\ contents.html' frame =' d:\ output\ frame.html';
Answer
  • a. D:\ Output\ body.html
  • b. D:\ Output\ contents.html
  • c. D:\ Output\ frame.html
  • d. There are no links from the file D:\ Output\contents.html.

Question 86

Question
The table of contents created by the CONTENTS = option contains a numbered heading for
Answer
  • a. each procedure
  • b. each procedure that creates output.
  • c. each procedure and DATA step.
  • d. each HTML file created by your program.

Question 87

Question
When the code shown below is run, what will the file D:\ Output\ frame.html display? ods html body =' d:\ output\ body.html' contents =' d:\ output\ contents.html' frame =' d:\ output\ frame.html';
Answer
  • a. The file D:\ Output\contents.html.
  • b. The file D:\ Output\frame.html.
  • c. The files D:\ Output\ contents.html and D:\ Output\body.html.
  • d. It displays no other files.

Question 88

Question
What is the purpose of the URL = suboptions shown below? ods html body =' d:\ output\ body.html' (url =' body.html') contents =' d:\ output\ contents.html' (url =' contents.html') frame =' d:\ output\ frame.html';
Answer
  • a. To create absolute link addresses for loading the files from a server.
  • b. To create relative link addresses for loading the files from a server.
  • c. To allow HTML files to be loaded from a local drive.
  • d. To send HTML output to two locations.

Question 89

Question
Which ODS HTML option was used in creating the following table?
Answer
  • a. format = brown
  • b. format =' brown'
  • c. style = brown
  • d. style =' brown'

Question 90

Question
What is the purpose of the PATH = option? ods html path =' d:\ output' (url = none) body =' body.html' contents =' contents.html' frame =' frame.html';
Answer
  • a. It creates absolute link addresses for loading HTML files from a server.
  • b. It creates relative link addresses for loading HTML files from a server.
  • c. It allows HTML files to be loaded from a local drive.
  • d. It specifies the location of HTML file output.

Question 91

Question
Which program creates the output shown below?
Answer
  • a. data test2; infile furnture; input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18 Item $ 20-24 Price 26-31; if finish =' oak' then delete; retain TotPrice 100; totalprice + price; drop price; run; proc print data = test2 noobs; run;
  • b. data test2; infile furnture; input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18 Item $ 20-24 Price 26-31; if finish =' oak' and price < 200 then delete; TotalPrice + price; run; proc print data = test2 noobs; run;
  • c. data test2( drop = price); infile furnture; input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18 Item $ 20-24 Price 26-31; if finish =' oak' and price < 200 then delete; TotalPrice + price; run; proc print data = test2 noobs; run;
  • d. data test2; infile furnture; input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18 Item $ 20-24 Price 26-31; if finish = oak and price < 200 then delete price; TotalPrice + price; run; proc print data = test2 noobs; run;

Question 92

Question
How is the variable Amount labeled and formatted in the PROC PRINT output? data credit; infile creddata; input Account $ 1-5 Name $ 7-25 Type $ 27 Transact $ 29-35 Amount 37-50; label amount =' Amount of Loan'; format amount dollar12.2; run; proc print data = credit label; label amount =' Total Amount Loaned'; format amount comma10.; run;
Answer
  • a. label Amount of Loan, format DOLLAR12.2
  • b. label Total Amount Loaned, format COMMA10.
  • c. label Amount, default format
  • d. The PROC PRINT step does not execute because two labels and two formats are assigned to the same variable.

Question 93

Question
Consider the IF-THEN statement shown below. When the statement is executed, which expression is evaluated first? if finlexam > = 95 and (research =' A' or (project =' A' and present =' A')) then Grade =' A +';
Answer
  • a. finlexam > = 95
  • b. research =' A'
  • c. project =' A' and present =' A'
  • d. research =' A' or (project =' A' and present =' A')

Question 94

Question
Consider the small raw data file and program shown below. What is the value of Count after the fourth record is processed? data work.newnums; infile numbers; input Tens 2-3; Count + tens; run;
Answer
  • a. missing
  • b. 0
  • c. 30
  • d. 70

Question 95

Question
Now consider the revised program below. What is the value of Count after the third observation is read? data work.newnums; infile numbers; input Tens 2-3; retain Count 100; count + tens; run;
Answer
  • a. missing
  • b. 0
  • c. 100
  • d. 130

Question 96

Question
For the observation shown below, what is the result of the IF-THEN statements? if status =' OK' and type = 3 then Count + 1; if status =' S' or action =' E' then Control =' Stop';
Answer
  • a. Count = 12 Control = Go
  • b. Count = 13 Control = Stop
  • c. Count = 12 Control = Stop
  • d. Count = 13 Control = Go

Question 97

Question
Which of the following can determine the length of a new variable?
Answer
  • a. the length of the variable's first reference in the DATA step
  • b. the assignment statement
  • c. the LENGTH statement
  • d. all of the above

Question 98

Question
Which set of statements is equivalent to the code shown below? if code =' 1' then Type =' Fixed'; if code =' 2' then Type =' Variable'; if code ^ =' 1' and code ^ =' 2' then Type =' Unknown';
Answer
  • a. if code =' 1' then Type =' Fixed'; else if code =' 2' then Type =' Variable'; else Type =' Unknown';
  • b. if code =' 1' then Type =' Fixed'; if code =' 2' then Type =' Variable'; else Type =' Unknown';
  • c. if code =' 1' then type =' Fixed'; else code =' 2' and type =' Variable'; else type =' Unknown';
  • d. if code =' 1' and type =' Fixed'; then code =' 2' and type =' Variable'; else type =' Unknown';

Question 99

Question
What is the length of the variable Type, as created in the DATA step below? data finance.newloan; set finance.records; TotLoan + payment; if code =' 1' then Type =' Fixed'; else Type =' Variable'; length type $ 10; run;
Answer
  • a. 5
  • b. 8
  • c. 10
  • d. It depends on the first value of Type

Question 100

Question
Which program contains an error?
Answer
  • a. data clinic.stress( drop = timemin timesec); infile tests; input ID $ 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33 RecHR 35-37 TimeMin 39-40 TimeSec 42-43 Tolerance $ 45; TotalTime =( timemin* 60) + timesec; SumSec + totaltime; run;
  • b. proc print data = clinic.stress; label totaltime =' Total Duration of Test'; format timemin 5.2; drop sumsec; run;
  • c. proc print data = clinic.stress( keep = totaltime timemin); label totaltime =' Total Duration of Test'; format timemin 5.2; run;
  • d. data clinic.stress; infile tests; input ID $ 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33 RecHR 35-37 TimeMin 39-40 TimeSec 42-43 Tolerance $ 45; TotalTime =( timemin* 60) + timesec; keep id totaltime tolerance; run;

Question 101

Question
If you submit the following program, which variables appear in the new data set? data work.cardiac( drop = age group); set clinic.fitness( keep = age weight group); if group = 2 and age > 40; run;
Answer
  • a. none
  • b. Weight
  • c. Age, Group
  • d. Age, Weight, Group

Question 102

Question
Which of the following programs correctly reads the data set Orders and creates the data set FastOrdr?
Answer
  • a. data catalog.fastordr( drop = ordrtime); set july.orders( keep = product units price); if ordrtime < 4; Total = units* price; run;
  • b. data catalog.orders( drop = ordrtime); set july.fastordr( keep = product units price); if ordrtime < 4; Total = units* price; run;
  • c. data catalog.fastordr( drop = ordrtime); set july.orders( keep = product units price ordrtime); if ordrtime < 4; Total = units* price; run;
  • d. None of the above

Question 103

Question
Which of the following statements is false about BY-group processing? When you use the BY statement with the SET statement:
Answer
  • a. The data sets listed in the SET statement must be indexed or sorted by the values of the BY variable( s).
  • b. The DATA step automatically creates two variables, FIRST. and LAST., for each variable in the BY statement.
  • c. FIRST. and LAST. identify the first and last observation in each BY group, respectively.
  • d. FIRST. and LAST. are stored in the data set.

Question 104

Question
There are 500 observations in the data set Usa. What is the result of submitting the following program? data work.getobs5; obsnum = 5; set company.usa( keep = manager payroll) point = obsnum; stop; run;
Answer
  • a. an error
  • b. an empty data set
  • c. continuous loop
  • d. a data set that contains one observation

Question 105

Question
There is no end-of-file condition when you use direct access to read data, so how can your program prevent a continuous loop?
Answer
  • a. Do not use a POINT = variable.
  • b. Check for an invalid value of the POINT = variable.
  • c. Do not use an END = variable.
  • d. Include an OUTPUT statement.

Question 106

Question
Assuming that the data set Company.USA has five or more observations, what is the result of submitting the following program? data work.getobs5; obsnum = 5; set company.usa( keep = manager payroll) point = obsnum; output; stop; run;
Answer
  • a. an error
  • b. an empty data set
  • c. a continuous loop
  • d. a data set that contains one observation

Question 107

Question
Which of the following statements is true regarding direct access of data sets?
Answer
  • a. You cannot specify END = with POINT =.
  • b. You cannot specify OUTPUT with POINT =.
  • c. You cannot specify STOP with END =.
  • d. You cannot specify FIRST. with LAST.

Question 108

Question
What is the result of submitting the following program? data work.addtoend; set clinic.stress2 end = last; if last; run;
Answer
  • a. an error
  • b. an empty data set
  • c. a continuous loop
  • d. a data set that contains one observation

Question 109

Question
At the start of DATA step processing, during the compilation phase, variables are created in the program data vector (PDV), and observations are set to:
Answer
  • a. blank
  • b. missing
  • c. 0
  • d. there are no observations.

Question 110

Question
The DATA step executes:
Answer
  • a. continuously if you use the POINT = option and the STOP statement.
  • b. once for each variable in the output data set.
  • c. once for each observation in the input data set.
  • d. until it encounters an OUTPUT statement.
Show full summary Hide full summary

Similar

Statistics Key Words
Culan O'Meara
SAMPLING
Elliot O'Leary
FREQUENCY TABLES: MODE, MEDIAN AND MEAN
Elliot O'Leary
HISTOGRAMS
Elliot O'Leary
CUMULATIVE FREQUENCY DIAGRAMS
Elliot O'Leary
TYPES OF DATA
Elliot O'Leary
GROUPED DATA FREQUENCY TABLES: MODAL CLASS AND ESTIMATE OF MEAN
Elliot O'Leary
Statistics Vocab
Nabeeha Yusuf
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
chapter 1,2 statistics
Rigo Sanchez
Statistics, Data and Area (Semester 2 Exam)
meg willmington