{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

SAS 认证-真题集1.pdf - SAS Base Programming version 9...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: SAS Base Programming version 9 Certification Exam Study Guide SAS Exam # ADO-211 Study Guide www.ePlanetLabs.com SAS QUESTIONS and ANSWERS 1. A raw data file is listed below. 1---+----10---+-———20---+--- son Frank 01/31/89 daughter June 12-25-87 brother Samuel 01/17/51 The following program is submitted using this file as input: data work.family; infile 'file-specification'; <insert INPUT statement here>run;Which INPUT statement correctly reads the values for the variable Birthdate as SAS date values? a. input relation $ first_name $ birthdate date9.; b. input relation $ first_name $ birthdate mmddyy8.; c. input relation $ first_name $ birthdate : date9.; cl. input relation $ first_name $ birthdate : mmddyy8.; Correct answer: ddd An informat is used to translate the calendar date to a SAS date value. The date values are in the form of two-digit values for month-day-year, so the MMDDYY8. informat must be used. When using an informat with list input, the colon-format modifier is required to correctly associate the informat with the variable name.You can learn about - informats in Reading Date and Time Values -the colon-format modifier in Reading Free- Format Data. 2. A raw data file is listed below.1---+—-—-10—--+----20——-+--- Jose,47,210 Sue,,108 The following SAS program is submitted using the raw data file above as input: data employeestats; <insert INFILE statement here> input name $ age weight;run;The following output is desired:name age weight Jose 47 210 Sue . 108 Which of the following INFILE statements completes the program and accesses the data correctly? a. infile 'file—specification' pad; b. infile 'file-specification' dsd; c. infile 'file-specification' dlm=','; d. infile 'file-specification' missover; Correct answer: bbb The PAD option specifies that SAS pad variable length records with blanks. The MISSOVER option prevents SAS from reading past the end of the line when reading free formatted data. The DLM= option specifies the comma as the delimiter; however, consecutive delimiters are treated as one by default. The DSD option correctly reads the data with commas as delimiters and two consecutive commas indicating a missing value like those in this raw data file. You can learn about - the PAD option in Reading Raw Data in Fixed Fields - the MISSOVER option in Creating Multiple Observations from a www.ePlanetLabs.com All Rights Reserved 512 SAS Base Programming version 9 Certification Exam Study Guide SAS Exam # AGO-211 Study Guide www.eP|anetLabs.com Which one of the following explains why a report fails to generate? a. The DATA step fails execution. b. The SAS data set Sales does not exist. c. The SAS data set Sales has no observations. d. The PRINT procedure contains a syntax error. Correct answer: bbb The DATA step creates a permanent SAS data set, Sasdata.Salesdata. The PRINT procedure is printing a temporary SAS data set, Sales, that is stored in the Work library. At the beginning of the SAS session, Work.Sales does not exist.You can learn about - creating permanent data sets with the DATA step in Creating SAS Data Sets from Raw Data - temporary data sets in Basic Concepts. 6. Which action assigns a reference named SALES to a permanent SAS data library? a. Issuing the command: libref SALES 'SAS-data-library' b. Issuing the command: libname SALES 'SAS-data-library' c. Submitting the statement: libref SALES 'SAS-data-library'; d. Submitting the statement: libname SALES 'SAS-data-library‘; Correct answer: ddd The LIBNAME statement assigns a reference known as a libref to a permanent SAS data library. The LIBNAME command opens the LIBNAME window.You can learn about the LIBNAME statement in Referencing Files and Setting Options. 7. The following SAS program is submitted: data newstaff; set staff; <insert WHERE statement here>run;Which one of the following WHERE statements completes the program and selects only observations with a Hire_date of February 23, 2000? a. where hire_date='23feb2000'd; b. where hire_date='23feb2000'; c. where hire_date='02/23/2000'd; cl. where hire_date='02/23/2000'; Correct answer: aaa A SAS date constant must take the form of one— or two-digit day, three-digit month, and two- or four—digit year, enclosed in quotation marks and followed by a d ('ddmmmyy<yy>'d).You can learn about SAS date constants in Creating SAS Data Sets from Raw Data. 8. Which one of the following SAS date formats displays the SAS date value for January 16, 2002 in the form of 16/01/2002? a. DATE10. b. DDMMYY10. c. WEEKDATE10. d. DDMMYYYYlO. Correct answer: bbb The requested output is in day-month-year order and is 10 bytes long, so DDMMYY10. is the correct format. Although WEEKDATE10. is a valid SAS format, it does not display the SAS date value as shown in the question above. DDMMYYYYlO. is not a valid SAS date format, and the DATEw. format www.ePlanetLabs.com All Rights Reserved 514 SAS Base Programming version 9 Certification Exam Study Guide SAS Exam # ADO-211 Study Guide www.ePlanetLabs.com Which of the following describes the Sasuser.Houses data set? a. The data set is sorted but not indexed. b. The data set is both sorted and indexed. c. The data set is not sorted but is indexed. d. The data set is neither sorted nor indexed. Correct answer: ddd The exhibit above shows partial output from the CONTENTS procedure, In the top right-hand column of the output, you see that Indexes has a value of O, which indicates that no indexes exist for this data set. Also, Sorted has a value of NO, which indicates that the data is not sorted.You can learn about the CONTENTS procedure in Referencing Files and Setting Options. 12. The following SAS program is submitted: proc sort data=work.test; by fname descending salary;run;Which one of the following represents how the observations are sorted? a. The data set Work.Test is stored in ascending order by both Fname and Salary values. b. The data set Work.Test is stored in descending order by both Fname and Salary values. c. The data set Work.Test is stored in descending order by Fname and ascending order by Salary values. d. The data set Work.Test is stored in ascending order by Fname and in descending order by Salary values. Correct answer: ddd The DESCENDING keyword is placed before the variable name it modifies in the BY statement, so the correct description is in descending order by Salary value within ascending Fname values.You can learn about the SORT procedure and the DESCENDING keyword in Creating List Reports. 13. The following SAS program is submitted: data names; title='EDU'; if title='EDU' then Division='Education'; else if title='HR' then Division='Human Resources'; else Division='Unknown';run;Which one of the following represents the value of the variable Division in the output data set? a. Educatlo b. Education c. Human Re cl. Human Resources Correct answer: bbb The length of the variable Division is set to 9 when the DATA step compiles. Since the value of the variable Title is EDU, the first IF condition is true; therefore, the value of the variable Division is Education.You can learn about - the length of a variable in Understanding DATA Step Processing IF—THEN statements in Creating and Managing Variables. 14. Which one of the following SAS programs creates a variable named City with a value of Chicago? a. data work.airports; AirportCode='ord'; if AirportCode='ORD' City='Chicago';run; b. data work.airports; AirportCode='ORD'; if AirportCode='ORD' City='Chicago';run; www.ePlanetLabs.com All Rights Reserved 516 SAS Base Programming version 9 Certification Exam Study Guide SAS Exam # ADO-211 Study Guide www.ePlanetLabs.com b. Under 60 c. Over 60 d. ' ' (missing character value) Correct answer: aaa The variable description is being created by the IF-THEN/ELSE statement during compilation. The first occurrence of the variable description is on the IF statement, and since it is assigned the value Over 60, the length of the variable is 7. Therefore, for the salary value of 30000, description has the value of Under 6 (the 0 is trSAS Guideated.) You can learn about - the compilation phase of the DATA step in Understanding DATA Step Processing - IF-THEN/ELSE statements in Creating and Managing Variables. 18. A raw data file is listed below.1---+----10—--+—---20—--+-—- 10 23 20 15 The following program is submitted: data a||_sales; infile 'file-specification'; input receipts; <insert statement(s) here>run;Which statement(s) complete(s) the program and produce(s) a running total of the Receipts variable? a. total+receipts; b. total 0;sum total; c. total=total+receipts; d. total=sum(total,receipts); Correct answer: aaa The SUM fSAS Guidetion and the assignment statement do not retain values across iterations of the DATA step. The sum statement total+receipts; initializes total to 0, ignores missing values of receipt, retains the value of total from one iteration to the next, and adds the value of receipts to total.You can learn about the sum statement in Creating and Managing Variables. 19. A raw data file is listed below.1---+----10---+----20---+--- 1901 2 1905 1 1910 6 1925 1 1941 1 The following SAS program is submitted and references the raw data file above: data money; infile 'file-specification'; input year quantity; total=total+quantity;run;What is the value of total when the data step finishes executing? a. 0 b. 1 c. 11 cl. . (missing numeric value) Correct answer: ddd www.ePlanetLabs.com All Rights Reserved 518 SAS Base Programming version 9 Certification Exam Study Guide SAS Exam # ADO-211 Study Guide www.eP|anetLabs.com A DO UNTIL loop always executes at least once because the condition is not evaluated until the bottom of the loop. In the SAS program above, the value of Products is incremented from 7 to 8 on the first iteration of the DO UNTIL loop, before the condition is checked. Therefore the value of Products is 8.You can learn about DO UNTIL loops in Generating Data with DO Loops. 23. The following program is submitted: data work.test; set work.staff (keep=salary1 salary2 salary3); <insert ARRAY statement here>run;Which ARRAY statement completes the program and creates new variables? a. array salary{3}; b. array new_salary{3}; c. array salary{3} salaryl-salary3; d. array new_salary{3} salaryl-salary3; Correct answer: bbb Although each of the ARRAY statements listed above is a valid statement, only Answer B creates new variables named new_salaryl, new_salary2 and new_salary3. Answer C and Answer D both create an array that groups the existing data set variables salaryl, salary2, and salary3. Since the array in Answer A is named salary, it also uses the existing data set variables.You can learn about creating new variables in an ARRAY statement in Processing Variables with Arrays. 24. Which of the following permanently associates a format with a variable? a. the FORMAT procedure b. a FORMAT statement in a DATA step c. an INPUT fSAS Guidetion with format modifiers d. an INPUT statement with formatted style input Correct answer: bbb To permanently associate a format with a variable, you use the FORMAT statement in a DATA step. You can use the FORMAT procedure to create a user-defined format. You use the INPUT fSAS Guidetion to convert character data values to numeric values with an informat. You use the INPUT statement to read data into a data set with an informat.You can learn about - permanently assigning a format to a variable in Creating and Managing Variables - the FORMAT statement in Creating List Reports - the FORMAT procedure in Creating and Applying User-Defined Formats - the INPUT fSAS Guidetion in Transforming Data with SAS FSAS Guidetions - the INPUT statement in Reading Raw Data in Fixed Fields. 25. The following report is generated: Styleof homes n AskingPrice CONDO 4 $99,313 RANCH 4 $68,575 SPLIT 3 $77,983 TWOSTORY 4 $83,825 www.ePIanetLabs.com All Rights Reserved 520 SAS Base Programming version 9 Certification Exam Study Guide SAS Exam # ADO-211 Study Guide www.eP|anetLabs.com data=sasuser.houses;run;proc freq data=sasuser.shoes;run;ods html close;proc print data=sasuser.shoes;run;How many HTML files are created? a. 1 b. 2 c. 3 d. 4 Correct answer: aaa By default, one HTML file is created for each FILE= option or BODY= option in the ODS HTML statement. The ODS HTML CLOSE statement closes the open HTML file and ends the output capture. The Newfile.html file contains the output from the PRINT, MEANS, and FREQ procedures.You can learn about the ODS HTML statement in Producing HTML Output. 29. A frequency report of the variable Jobcode in the Work.Actors data set is listed below.Jobcode Frequency Percent CumulativeFrequency CumulativePercent ActorI 2 33.33 2 33.33 Actor II 2 33.33 4 66.67 Actor III 2 33.33 6 100.00 Frequency Missing = 1 The following SAS program is submitted: data work.joblevels; set work.actors; if jobcode in ('Actor 1', 'Actor 11') then joblevel='Beginner'; if jobcode='Actor 111' then joblevel='Base'; else joblevel='Unknown';run;Which of the following represents the possible values for the variable joblevel in the Work.Joblevels data set? a. Base and Unknown only b. Beginner and Base only c. Beginner, Base, and Unknown d. ' ' (missing character value) Correct answer: aaa The DATA step will continue to process those observations that satisfy the condition in the first IF statement Although Joblevel might be set to Beginner for one or more observations, the condition on the second IF statement will evaluate as false, and the ELSE statement will execute and overwrite the value of Joblevel as Unknown.You can learn about - the IF statement in Creating SAS Data Sets from Raw Data - the ELSE statement in Creating and Managing Variables. 30. The descriptor and data portions of the Work.Salaries data set are shown below.Variable Type Len Pos name Char 8 0 salaryChar 8 16 statusChar 8 8 name status salary Liz S 15,600 Herman S 26,700 Marty S 35,000 www.ePlanetLabs.com All Rights Reserved 522 SAS Base Programming version 9 Certification Exam Study Guide SAS Exam # ADO-211 Study Guide Vinlvw.ePlanetLabs.com b. animall animal2 mlgramsl mlgramsZ hummingb ostrich 54000.39 9080000087 c. animall animal2 mlgramsl mlgramsZ hummingbird ostrich 54000.39 90800000 Cl. animall anima|2 mlgramsl mlgramsZ hummingbird ostrich 54000.39 9080000087 Correct answer: bbb The CARDS statement is an alias for the DATALINES statement. In the INPUT statement, you must specify a dollar sign (35) after the variable name in order to define a character variable. If you do not specify otherwise, the default storage length for a variable is 8. In the example above, the character value hummingbird is trSAS Guideated to hummingb.You can learn about - the DATALINES statement in Creating SAS Data Sets from Raw Data -the INPUT statement in Reading Free-Format Data - the default storage length for variables in Basic Concepts. 34. The SAS data sets Work.Employee and Work.Sa|ary are shown below. Work.Employeefname age Bruce 30 Dan 40 Work.Sa|aryfname salary Bruce 25000 Bruce 35000 Dan 25000 The following merged SAS data set is generated: Work.Empdata fname age totsal Bruce 30 60000 Dan 40 25000 Which one of the following SAS programs created the merged data set? a. data work.empdata; merge work.employee work.salary; by fname; if first.fname then totsal=0; totsal+salary; if |ast.fname then output;run; b. data work.empdata(drop=salary); merge work.employee work.salary; by fname; if first.fname then totsal=0; totsal+salary; if |ast.fname then output;run; c. data work.empdata; merge work.employee work.salary(drop=salary); by fname; if first.fname then total=0; totsal+salary; if |ast.fname then output;run; d. data work.empdata; merge work.employee work.salary; by fname; if first.fname then total+sa|ary;run; Correct answer: bbb www.ePlanetLabs.com All Rights Reserved 524 SAS Base Programming version 9 Certification Exam Study Guide SAS Exam # ADO-211 Study Guide www.ePlanetLabs.com You use the keyword DESCENDING in a BY statement to specify that data will be sorted by values in descending order. The DESCENDING keyword applies to the variable that is listed immediately after it. To sort on values of bonus within sorted values of employee, you list employee first in the BY statement.You can learn about the DESCENDING keyword and the BY statement in Creating List Reports. 37. The following SAS program is submitted: data work.accounting; length jobcode $ 12; set work.department;run;The Work.Department SAS data set contains a character variable named jobcode with a length of 5. Which of the following is the length of the variable jobcode in the output data set? a. 5 b. 8 c. 12 cl. The value cannot be determined because the program fails to execute clue to syntax errors. Correct answer: ccc The LENGTH statement enables you to specify the length of a character variable. Since the LENGTH statement appears before the SET statement, SAS will set the length of jobcode to 12.You can learn about the LENGTH statement in Creating and Managing Variables. 38. Assume the SAS data set Sasuser.Houses has four numeric variables.The following SAS program is submitted: proc means data=sasuser.houses mean; <insert statement(s) here>run;The following report is produced: style N Obs Variable Mean CONDO 4 bedroomsbaths 2.75000002.1250000 RANCH 4 bedroomsbaths 2.25000002.0000000 SPLIT 3 bedroomsbaths 2.66666671.8333333 TWOSTORY 4 bedroomsbaths 3.00000001.8750000 Which of the following statement(s) create(s) this report? a. class style; b. var bedrooms baths; c. class style;var bedrooms baths; cl. var style;class bedrooms baths; Correct answer: ccc The CLASS statement specifies the category variable(s) for group processing. The VAR statement specifies the numeric variable(s) for which to calculate statistics.You can learn about the CLASS statement and the VAR statement in Producing Descriptive Statistics. 39. An HTML file contains a SAS report. Which ODS statement option is used to specify the name of the HTML file? a.OUT= b. FILE= c. HTML= cl. HTMLFILE= Correct answer: bbb The FILE= option identifies the file that contains the HTML output. The FILE= option is an alias for the BODY: option in the ODS HTML www.ePlanetLabs.com All Rights Reserved 526 SAS Base Programming version 9 Certification Exam Study Guide SAS Exam # ADO-211 Study Guide www.ePlanetLabs.com d. libname sasdata 'SAS-data-library';data all; merge sasdata.products(in=inp) sasdata.sa|es(in=ins); by prod_id; if ins=0 or inp=0;run; Correct answer: ddd By default, DATA step match-merges combine all observations in all input data sets. To include only unmatched observations from your output data set, you can use the IN: data set option to create and name a temporary variable that indicates whether the data set contributed to the current observations. If the value of the IN: variable is O, the data set did not contribute to the current observation; if the value is 1, the data set did contribute to the current observation. You can use a subsetting IF statement to only include those observations that have a value of 0 for the IN: variable of either the Sasdata.Products data set or the Sasdata.Sales data set. Since an unmatched observation might come from either input data set, you do not need to specify that the IN: variables for both Sasdata.Products and Sasdata.Sales have values of O.You can learn about the IN: data set option in Combining SAS Data Sets. 43. The following SAS program is submitted: libname sasdata 'SAS-data- library';libname labdata 'SAS-data-library';data labdata.boston |abdata.da|las(drop=city dest equipment); set sasdata.cities(keep=orig dest city price equipment); if dest='BOS' then output labdata.boston; else if dest='DFW' then output |abdata.da|las;run;Which variables are output to both data sets? a. price and orig only b. city and equipment only c. city, price, and equipment only d. city, price, orig, and equipment Correct answer: aaa In the program above, the KEEP= option specifies ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern