Day 21 SAS

¡Supera tus tareas y exámenes ahora con Quizwiz!

False (A comment is text in your program that SAS ignores during processing, but writes to the SAS log.)

A comment is text in your program that SAS processes along with the other SAS steps in your program. (T/F) a. True b. False

False (Numeric values are stored in floating point notation in 8 bytes of storage, allowing a maximum of 16-17 digits.)

A numeric variable can store numeric values with a maximum of eight digits. (T/F) a. True b. False

Yes (SAS data sets contain data that is created only by SAS and can be read only by SAS. )

Are SAS data sets created only by SAS? a. Yes b. No

Yes (Raw data files are files that contain non-software-specific data.)

Are raw data files created only by SAS? a. Yes b. No

Yes (You can save and reuse SAS program files.)

Can a SAS program be saved and reused? a. Yes b. No

a. No. The comment is correctly specified. (A block comment begins with a forward slash and an asterisk, followed by your comment text, and ends with an asterisk and forward slash. A block comment can be any length, and can contain semicolons.)

Does this comment contain syntax errors? /* Report created for budget presentation; revised October 15. */ proc print data=work.newloan; run; a. No. The comment is correctly specified. b. Yes. Every comment line must end with a semicolon. c. Yes. The comment text incorrectly begins on line one. d. Yes. The comment contains a semicolon, which causes an error message.

- Period - Blank (Employee_ID has a missing value that is displayed as a period. A missing value is displayed as a period for numeric variables and as a blank for character variables. Also, numeric values are right-justified and character values are left-justified by default.)

How is a missing value displayed for - numeric variables? - Character variables?

c. six (RUN, QUIT, DATA, and PROC statements function as step boundaries, which determine when SAS statements take effect and indicate the end of the current step or the beginning of a new step.)

How many step boundaries does this program contain? data work.staff; length First_Name $ 12 Last_Name $ 18 Job_Title $ 25; infile "&path/newemployees.csv" dlm=','; input First_Name $ Last_Name$ Job_Title $ Salary; run; proc print data=work.staff; run; proc means data=work.staff; var Salary; run; a. four b. five c. six d. seven

C. values of a variable (These are the values for the variable Height. Recall that in SAS, the observations are the rows in a data set, and variables are the columns in a data set. The values 72, 64, 68, and 76 are displayed in the column for Height.)

In this data set, what do the values 72, 64, 68, and 76 represent? ID Height Weight Age 54209 72 165 35 38204 64 122 46 10462 68 154 28 38754 76 188 51 a. an observation b. four observations c. values of a variable

a. descriptor portion (The descriptor portion contains general properties, such as the data set name and number of observations. It also contains the variable properties, including the name, type, and length of variables. The data portion contains the data, or variable values.)

In which portion of a SAS data set are the following found? - name of the data set - type of the variable "Salary" - creation date of the data set a. descriptor portion b. data portion

False, can't mix types of quotations (Also, although SAS allows either single or double quotation marks, you can't mix the types. If you begin with a single quotation mark, you must end with a single quotation mark; otherwise, SAS considers the quotation marks unbalanced.)

SAS allows either single or double quotation marks. If you begin with a single quotation mark, you can end with a double quotation mark. a. True b. False

True, SAS statements are free format (SAS statements are free format. In other words, they can begin and end anywhere. In SAS, you can have as much or as little white space as you want. According to SAS syntax rules, you can begin or end a statement in any column and span multiple lines. You can also place multiple statements on one line, and unquoted values can be lowercase, uppercase, or mixed case.)

SAS permits your programs to be free format. a. True b. False

a. no titles (No titles will appear at the top of the second PROC PRINT report. The null TITLE statement above that statement cancels all previously specified titles.)

Suppose you already ran the first program, which created a one-page report. Next, you want to run the second program. What will appear at the top of the second report? title1 'RADIX Company'; title3 'DVD Sales'; proc print data=radix.sales; where UnitSold>=30; run; title2 'Best Sales; title; proc print data=radix.staff; where Sales>25000; run; a. no titles b. RADIX Company Best Sales DVD Sales c. RADIX Company Best Sales d. RADIX Company

False (You use the CLEAR option in the LIBNAME statement to cancel, or disassociate, a libref that you previously assigned.)

To disassociate a libref that you previously assigned, you can use the UNASSIGN option in the LIBNAME statement. (T/F) a. True b. False

True (Using SAS, you can read many kinds of data. You might have data stored in SAS, in a raw data file, in Oracle, in Excel, or in other types of files.)

Using SAS, you can read many kinds of data. a. True b. False

a. SAS programming code (SAS program files contain SAS programming code. These instructions tell SAS how to process your data and what output to create.)

What does a SAS program file contain? a. SAS programming code b. data specific to SAS c. an embedded Excel worksheet

SAS assumes that the keyword PROC is misspelled and executes the PROC PRINT step. (The log will indicate that SAS assumed that the keyword PROC was misspelled, corrected it temporarily, and executed the PROC step.)

What happens if you submit the following program? porc print data=work.newsalesemps; run; a. SAS does not execute the step. b. SAS assumes that the keyword PROC is misspelled and executes the PROC PRINT step.

8 bytes

What is the default length of a numeric variable?

An error message in the log (There is a missing semicolon following the data set name. As a result, the PROC PRINT step will not execute and an error message will be displayed in the log.)

What result would you expect from submitting this step? proc print data=work.newsalesemps run; a. a list report of the work.newsalesemps data set b. an error message in the log c. a summary report of the work.newsalesemps data set d. the creation of a temporary data set called work.newsalesemps

a. temporary (When you specify a one-level data set name, SAS assumes the library is work and the data set is temporary.)

What type of data set is the input data set in this PROC PRINT step? proc print data=order_fact; run; a. temporary b. permanent c. There is not enough information to determine the type.

a. The Top Line (The TITLE statement in the last PROC PRINT step changes the first title line and cancels all previously specified titles with line numbers higher than 1. )

When you run this code, which title or titles appear in the last PROC PRINT output? title1 'The First Line'; title2 'The Second Line'; proc print data=orion.sales; run; title2 'The Next Line'; proc print data=orion.sales; run; title 'The Top Line'; proc print data=orion.sales; run; a. The Top Line b. The Top Line The First Line c. The Top Line The First Line The Next Line

anywhere in a SAS program (Global statements can appear anywhere in a SAS program—either inside or outside of DATA and PROC steps—and can affect more than one step.)

Where do global statements appear? a. anywhere in a SAS program b. only inside DATA steps c. only inside PROC steps d. only inside DATA steps or PROC steps

d. by Gender; (You can group by Gender because Gender is the first variable that the data set is sorted by. You could also group by Gender and then Start_Date because the data set is sorted by these variables in the same order. You cannot use the other BY statements because the variables are not specified for grouping in the same order that the data set is sorted.)

Which BY statement is valid for this PROC PRINT step? proc sort data=orion.staff out=work.staff_sort; by Gender Start_Date; run; proc print data=work.staff_sort label; by _____________________________; label Start_Date='Start'; run; a. by Start_Date Gender; b. by Start; c. by descending Gender; d. by Gender;

a. libname reports 'filepath/workshop'; (In a basic LIBNAME statement, you specify the keyword LIBNAME, a valid libref, and then the physical name of the library in quotation marks.)

Which LIBNAME statement has the correct syntax? a. libname reports 'filepath/workshop'; b. libname orion filepath/workshop; c. libname 3456a 'filepath/workshop';

d. observations 1 and 3 (Expressions in the WHERE statement are case sensitive. This WHERE statement returns only those values that contain the exact character string shown. The position of the substring within the value is not important.)

Which observation or observations will be selected by the following WHERE statement? where Job_Title contains 'I'; Obs/ Last_Name/ First_Name/ Country/ Job_Title 1/ Wu/ Christine/ AU/ Sales Rep I 2/ Stone/ Kimiko/ AU / Sales Manager 3/ Hoffman/ Fred / AU/ Insurance Sales a. observation 1 b. observation 2 c. observation 3 d. observations 1 and 3 e. all observations

b. orion.sales (Any library that you create is a permanent library and is available in subsequent SAS sessions. When a data set is in the temporary work library, you can optionally use a one-level name. A one-level name consists of only the data set name, such as sales or newsalesemps. When you specify a one-level name, SAS assumes that the data set is stored in the work library because work is the default libref.)

Which of the following data sets will be available if you start a new SAS session? a. sales b. orion.sales c. work.newsalesemps d. newsalesemps

d. End each statement with a semicolon. (SAS statements usually begin with an identifying keyword, and they must end with a semicolon. Although it is recommended to end steps with a RUN statement, it is optional. The other listed items are related to formatting your programs to make them easier to read.)

Which of the following is a SAS syntax requirement? a. Begin each statement in column one. b. Put only one statement on each line. c. Separate each step with a line space. d. End each statement with a semicolon. e. Put a RUN statement after every DATA or PROC step.

c. Car_2012 (This libref follows all three rules for valid librefs. A libref must have a length of one to eight characters, and must begin with a letter or underscore. The remaining characters must be letters, numbers, or underscores.)

Which of the following librefs is valid? a. 2010Car b. car/2010 c. Car_2012 d. 1_or_a

A

Which of the following lists the steps in the programming process correctly? a. 1. Write a SAS program. 2. Debug or modify. 3. Run the program. 4. Review the results. 5. Define the business need. b. 1. Define the business need. 2. Write a SAS program. 3. Run the program. 4. Review the results. 5. Debug or modify.

d. where Style in ('RANCH','SPLIT','TWOSTORY'); (In the WHERE statement, the IN operator enables you to select observations based on several values. You specify values in parentheses and separate them by spaces or commas. Character values must be enclosed in quotation marks and must be in the same case as in the data set.)

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? a. where Style='RANCH' or 'SPLIT' or 'TWOSTORY'; b. where Style in 'RANCH' or 'SPLIT' or 'TWOSTORY'; c. where Style in (RANCH, SPLIT, TWOSTORY); d. where Style in ('RANCH','SPLIT','TWOSTORY');

d. all of the above (All of the statements shown here select rows in which Amount is less than or equal to $5000 or Rate equals 0.095.)

Which of the following statements selects rows in which Amount is less than or equal to $5,000 or Rate equals 0.095? a. where amount <= 5000 or rate=0.095; b. where amount le 5000 or rate=0.095; c. where amount <= 5000 or rate eq 0.095; d. all of the above

b. PROC (PROC steps are typically used to process SAS data sets (that is, generate reports, graphs, and statistics).

Which of the following steps is typically used to generate reports and graphs? a. DATA b. PROC c. REPORT d. RUN

b. proc print data=orion.staff split='+'; var Employee_ID Emp_Hire_Date; label Employee_ID='EMP ID' Emp_Hire_Date='Employee+Hire Date'; run; (To display temporary labels in PROC PRINT output, you must specify either the SPLIT= option or the LABEL option in the PROC PRINT statement.)

Which program creates the output shown here? Obs EMP ID Employee Hire Date 1 120101 01JUL2001 2 120102 01JUN1989 3 120103 01JAN1974 4 120104 01JAN1981 5 120105 01MAY1999 6 120106 01JAN1974 a. proc print data=orion.staff; var Employee_ID Emp_Hire_Date; label Employee_ID='EMP ID' Emp_Hire_Date='Employee_Hire Date'; run; b. proc print data=orion.staff split='+'; var Employee_ID Emp_Hire_Date; label Employee_ID='EMP ID' Emp_Hire_Date='Employee+Hire Date'; run;

c. A semicolon should not appear after the input data set name. (This PROC SORT step has a syntax error: a semicolon in the middle of the PROC SORT statement. If you correct this syntax error, this step sorts orion.staff by Salary in descending order and by Manager_ID in ascending order. The step then creates the temporary data set work.staff_sort that contains the sorted observations and all variables.)

Which statement about this PROC SORT step is true? proc sort data=orion.staff; out=work.staff_sort; by descending Salary Manager_ID; run; a. The sorted data set overwrites the input data set. b. The observations are sorted by Salary in descending order, and then by Manager_ID in descending order. c. A semicolon should not appear after the input data set name. d. The sorted data set contains only the variables specified in the BY statement.

b. The PROC PRINT report displays only the observations in which the value of Country is AU. (The WHERE statement subsets the data so that the report displays only the observations in which the value of Country is AU. The input data set must be sorted by Gender, the variable specified in the BY statement. The LABEL and FORMAT statements affect only the report output; they do not affect the input data set.)

Which statement about this program is true? proc print data=orion.sales; var Employee_ID Salary; where Country='AU'; by Gender; label Salary='Annual Salary'; run; a. This program will run correctly only if orion.sales is sorted in ascending order by Country. b. The PROC PRINT report displays only the observations in which the value of Country is AU. c. The label and format specified in the program are stored in orion.sales.

d. Add the LABEL option to the PROC PRINT statement. (The LABEL statement is not a global statement. You can specify labels for multiple variables in one LABEL statement, or you can use a separate LABEL statement for each variable. To display temporary labels in your PROC PRINT report, you use the LABEL option in your PROC PRINT statement because PROC PRINT doesn't display labels automatically.)

You want the variables Birth_Date and Employee_Hire_Date to be labeled in your PROC PRINT report. What do you need to do to this program? proc print data=orion.employee_payroll; var Employee_ID Birth_Date Employee_Hire_Date Salary; label Birth_Date='Birth Date' Employee_Hire_Date='Hire Date'; run; a. Nothing. As a global statement, the LABEL statement in the PROC PRINT step will display the labels. b. Move the LABEL statement to the beginning of the program so that it acts as a global statement. c. Add another LABEL statement for Employee_Hire_Date because you can't specify two labels in one LABEL statement. d. Add the LABEL option to the PROC PRINT statement.


Conjuntos de estudio relacionados

Chapter 69: Management of Patients With Neurologic Infections, Autoimmune Disorders, and Neuropathies

View Set

Test #5 Davis's questions....................................

View Set

History of Student Affairs - Study Guide 1 (COMPS)

View Set

Technology in action Final study set

View Set