SAS Base Ch 2

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What range of dates are interpreted correctly by SAS?

1582 A.D. to 20,000 A.D.

How many Comments? *This program creates and uses the data set named work.newsalesemps.; data work.newsalesemps; length First_Name $ 12 Last_Name $ 18 Job_Title $ 25; infile "&path/newemps.csv" dlm=','; input First_Name $ Last_Name $ Job_Title $ Salary /*numeric*/; run; /* proc print data=work.newsalesemps; run; */ proc means data=work.newsalesemps; *var Salary; run;

4 /**/ and *;

How many step boundaries??? 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;

6. 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.

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

A A SAS engine is a set of internal instructions that SAS uses for writing to and reading from files in a SAS library. Each engine specifies the file format for files that are stored in the library, which in turn enables SAS to access files with a particular format. Some engines access SAS files, and other engines support access to other vendors' files.

Which time span is used to interpret two-digit year values if the YEARCUTOFF= option is set to 1950? a. 1950-2049 b. 1950-2050c. 1949-2050 d. 1950-2000

A The YEARCUTOFF= option specifies which 100-year span is used to interpret twodigit year values. The default value of YEARCUTOFF= is 1920. However, you can override the default and change the value of YEARCUTOFF= to the first year of another 100-year span. If you specify YEARCUTOFF=1950, then the 100-year span will be from 1950 to 2049.

Which statement prints a summary of all the files stored in the library named Area51? a. proc contents data=area51._all_ nods; b. proc contents data=area51 _all_ nods; c. proc contents data=area51 _all_ noobs d. proc contents data=area51 _all_.nods;

A To print a summary of library contents with the CONTENTS procedure, use a period to append the _ALL_ option to the libref. Adding the NODS option suppresses detailed information about the files.

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

A. 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.

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

A. 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.

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

B In the LIBNAME statement, you specify the library name before the engine name. Both are followed by the path.

How can you create SAS output in HTML format on any SAS platform? a. by specifying system options b. by using programming statements c. by using SAS windows to specify the result format d. you can't create HTML output on all SAS platforms

B You can create HTML output using programming statements on any SAS platform. In addition, on all except mainframe platforms, you can use SAS windows to specify HTML as a result format.

Which of the following samples of code is valid? a. title "New Sales Employees'; proc print data=work.NewSalesEmps; run; b. title 'New Sales Employees'; proc print data=work.NewSalesEmps; run;

B - Although SAS allows either single or double quotation marks, you can't mix the types. If you use one type to begin and a different type to end, SAS considers the quotation marks unbalanced.

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

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

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.

B. The log will indicate that SAS assumed that the keyword PROC was misspelled, corrected it temporarily, and executed the PROC step.

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

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

Which of the following represents a syntax error? Select all that apply. a. a statement that begins in column one b. invalid options c. missing semicolon d. multiple statements on one line e. a statement that spans multiple lines f. unmatched quotation marks g. using mixed case letters within quotation marks h. a misspelled keyword

BCFG

What does a DATA step typically create? a. raw data file b. program file c. SAS data set d. report

C

Assuming you are using SAS code and not special SAS windows, which one of the following statements is false? a. LIBNAME statements can be stored with a SAS program to reference the SAS library automatically when you submit the program. b. 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. c. Librefs can last from one SAS session to another. d. You can access files that were created with other vendors' software by submitting a LIBNAME statement.

C The LIBNAME statement is global, which means that librefs remain in effect until you modify them, cancel them, or end your SAS session. Therefore, the LIBNAME statement assigns the libref for the current SAS session only. You must assign a libref before accessing SAS files that are stored in a permanent SAS data library.

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; a. three b. four c. five d. six

C The five statements are: 1) the PROC PRINT statement (two lines long); 2) the VAR statement; 3) the WHERE statement (on the same line as the VAR statement); 4) the LABEL statement; and 5) the RUN statement (on the same line as the LABEL statement).

What does a PROC step typically create? a. raw data file b. program file c. SAS data set d. report

D

In order for the date values 05May1955 and 04Mar2046 to be read correctly, what value must the YEARCUTOFF= option have? a. a value between 1947 and 1954, inclusive b. 1955 or higher c. 1946 or higher d. any value

D As long as you specify an informat with the correct field width for reading the entire date value, the YEARCUTOFF= option doesn't affect date values that have fourdigit years.

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.

D. 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 can represent a step boundary? a. a RUN statement b. a QUIT statement c. a DATA statement d. a PROC statement e. all of the above

E

FIRSTOBS and OBS

FIRSTOBS gives you the first observation you request and OBS gives the number of observations you want to see. FIRSTOBS without OBS will read through the entire data set. You need OBS to tell SAS when to stop. You can do OBS=max

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

False. 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.

Which of the following rules is required by SAS syntax? Select all that apply. a. beginning a statement in a certain column b. ending a statement in a certain column c. spanning multiple lines d. adding multiple statements on one line e. using all uppercase for text that isn't within quotation marks f. using all lowercase for text that isn't within quotation marks g. none of the above

G

What does yearcutoff= do?

If you use two-digit year values in your data lines, external files, or programming statements, you should consider another important system option, the YEARCUTOFF= option. This option specifies which 100-year span is used to interpret two-digit year values.

What does NODATE and NONUMBER do?

NONUMBER and NODATE system options suppress the display of page numbers and the date in the PROC PRINT output. Page numbers are not displayed in the PROC FREQ output, either, but the date does appear at the top of the PROC FREQ output since the DATE option was specified.

Does this comment contain any errors? /* Report created for budget presentation; revised October 15. */ proc print data=work.newloan; run;

No. 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.

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

Yes. There is a missing semicolon following the data set name. When this step runs, SAS will interpret the word RUN as an option in the PROC PRINT statement (because of the missing semicolon). As a result, the PROC PRINT step will not execute and an error message will be displayed in the log.

How do you specify page numbers in proc print?

in the options with pageno=x ods listing; options nodate number pageno=3; proc print data=hrd.funddrive; run; ods listing close;


संबंधित स्टडी सेट्स

Chapter 32: Skin integrity and wound care

View Set

Article 300-General Requirements for Wiring Methods and Materials

View Set