SAS Certification Practice Exam: Base Programming

https://support.sas.com/edu/OLTRN/61030/m0001/base9quiz.htm

SAS Certification Practice Exam: Base Programming for SAS 9
®

®

Certification Practice Exam
You should read the introductory material before you take this practice exam. Select the best answer for each question and click Score My Practice Exam. 1. A raw data file is listed below.
1---+----10---+----20---+--01/05/1989 Frank 11 12/25/1987 June 13 01/05/1991 Sally 9

The following SAS program is submitted using this file as input: data work.family; infile 'file-specification'; input @1 date_of_birth mmddyy10. @15 first_name $5. @25 age 3; run; proc print data=work.family noobs; run; The following output is generated for the Work.Family data set:
Date_of_birth First_name Age 10597 Frank 10220 June . .

11327 Sally

.

Which of the following statements is true regarding the Work.Family output? a. The output has the expected data values. b. The output does not have the expected data values due to an invalid data set name. c. The output does not have the expected data values due to an invalid informat for Age only. d. The output does not have the expected data values due to invalid informats for both Age and Date_of_birth. 2. The following SAS program is submitted: data employees; infile 'file-specification'; input @1 name $10. @15 date date9 @25 department $; run; How many numeric variables are created? a. 0 b. 1 c. 2

1 of 18

10/22/2013 1:49 PM

2 of 18 10/22/2013 1:49 PM . input name $ age weight. infile 'file-specification' missover. It associates a file reference with an external file.108 The following SAS program is submitted using this file as input: data employeestats. run. b. d.210 Sue. 210 108 Which of the following INFILE statements completes the program and accesses the data correctly? a.'. It associates a library reference with a relational database.sas. It associates a file reference with a relational database. d.47. <insert INFILE statement here>. 1---+----10---+----20---+--Jose.. b. The following output is desired: name age weight Jose Sue 47 . 4. c. c. It associates a library reference with an external file. A raw data file is listed below. 3 3.SAS Certification Practice Exam: Base Programming https://support.com/edu/OLTRN/61030/m0001/base9quiz. infile 'file-specification' pad. infile 'file-specification' dsd.htm d. infile 'file-specification' dlm='. What is the function of the FILENAME statement in SAS? a.

10/20/2004 CONDO. street 16. bedrooms 1. b. input @1 +1 +1 @20 style $8 sqfeet 4. 3 of 18 10/22/2013 1:49 PM .com/edu/OLTRN/61030/m0001/base9quiz.5JEANS AVENUE $127. infile 'file-specification' dsd.10MAR2004 SPLIT.150 The following program is submitted using this file as input: data work. baths 3. infile 'file-specification'.SAS Certification Practice Exam: Base Programming https://support. Which one of the following INPUT statements reads the raw data file correctly? a. else input sqfeet saledate : mmddyy10.1400..1810. baths 3.1500. 5 d. <insert INPUT statement here> run..1190. input @1 +1 +1 @20 style $8.850 CONDO 2150 4 2.08/19/2004 The following SAS program is submitted using this file as input: data work. How many observations does the Work. bedrooms 1.houses. street $16 @40 price dollar8. 1---+----10---+----20---+--RANCH.sas. 3 c. sqfeet 4. c.1250.Condo_ranch data set contain? a. input @1 +1 +1 @20 style $8.1615. @40 price dollar8. if style = 'CONDO' or style = 'RANCH' then input sqfeet saledate : date9. run. baths 3. 1---+----10---+----20---+----30---+----40---+----50 TWOSTORY 1040 2 1SANDERS ROAD $55. sqfeet 4. 6 6.. A raw data file is listed below.20JAN2004 SPLIT.17JUN2004 TWOSTORY. input style $ @.12/31/2004 RANCH. 0 b.condo_ranch. bedrooms 1. A raw data file is listed below.htm 5.

The DATA step fails to execute.salesdata. The SAS data set Sasdata. run. 19 8. input @1 +1 +1 @20 style $8. 9. c. 7. bedrooms 1. @40 price dollar8. set sashelp. The SAS data sets Work. data sasdata. run. d. set sasdata. run. What is the result? a. @40 price dollar8. 6 variables are written to the data set Work. The SAS data set Sales does not exist.F are each sorted by the variable Name. 9 c. else gen = 'M'. b.M and Work. No variables are written to the data set Work. 10 d. proc print data=sales. drop=gender. b. 4 variables are written to the data set Work. d. How many observations does the Work. c. The data set Work.Test. 0 b. Sashelp.sales. 5 variables are written to the data set Work.Test.class(keep=name age gender height weight). if INF then gen = 'F'.com/edu/OLTRN/61030/m0001/base9quiz.F contains 9 observations.. 4 of 18 10/22/2013 1:49 PM . The following SAS program is submitted at the start of a new SAS session: libname sasdata 'SAS-data-library'. The SAS data set Sales has no observations.htm street $16. Which one of the following answers explains why a report fails to generate? a.Class contains 5 variables. baths 3 street 16.sas.. sqfeet 4. run. by name.M contains 10 observations. The following SAS program is submitted: data both.SAS Certification Practice Exam: Base Programming https://support.Both data set contain? a.Salesdata has 10 observations.Test. newage=age+1. profit=expenses-revenues. The following SAS program is submitted: data test(drop=age).Test. set M F(in = INF). and the data set Work.

output one.new. The SAS data set Work. x=12.z). What is the value of the Date variable? a. The data set Sasuser. run. 6 d. set work. 10. The following SAS program is submitted: data _null_. run.one one. 2005 12. date=mdy(x. y=10. c. b.Two x y 5 2 5 4 3 6 The following SAS program is submitted: data sasuser.One has 0 observations and the data set One has 0 observations.Sales_info are written to the Work. 2 b. The following SAS program is submitted: data work.y. run. z=05. a character string with the value 12/10/05 b.report.sas. 2005 d. 3 c.com/edu/OLTRN/61030/m0001/base9quiz. How many of the original 12 observations in Work. The PRINT procedure statement syntax is incorrect. d.One has 0 observations and the data set One has 3 observations. Sasdata.sales_info. The data set Sasuser.htm d. which represents the SAS date value for December 10. The data set Sasuser. a character string with the value 10Dec2005 c. a numeric value of 121005. The data set Sasuser.One has 3 observations and the data set One has 0 observations. and the variable Sales_Date contains a SAS date value for each of the 12 months.SAS Certification Practice Exam: Base Programming https://support. which represents the SAS date value for December 10.two. 9 13. set sasdata.Two is listed below. 5 of 18 10/22/2013 1:49 PM .One has 3 observations and the data set One has 3 observations. 11. What is the result? a. if qtr(sales_date) ge 3.Sales_info has one observation for each month in the year 2005.Report data set? a. The SAS data set Sasdata. The following SAS program is submitted: data work. a numeric value of 16780.

set one. The SAS data set One is listed below.SAS Certification Practice Exam: Base Programming https://support. TOTOBS 15. run.com/edu/OLTRN/61030/m0001/base9quiz. Which of the following options creates the variable Last? a. set old <insert option here> = last. by x. c.x.htm set old(keep=sales1 sales2). EOF c. if first. put sales1 sales2. 14. run.sas. A raw data file is created with a comma delimiter separating the fields. END b. One X Y Z 1 A 27 1 A 33 1 B 45 2 A 52 2 B 69 3 B 70 4 A 82 4 C 91 The following SAS program is submitted: data two. file 'file-specification'. What is the result? a. No raw data file is created. run. XYZ 1 A 27 6 of 18 10/22/2013 1:49 PM . b. PTOBS d. Which of the following reports is the result? a. The DATA step fails execution because no delimiter is specified. proc print data=two noobs. A raw data file is created with no delimiter separating the fields. if last then put 'This is the end of the data set'. The following SAS program is submitted: data _null_. run. d. put sales1 sales2. A raw data file is created with a space delimiter separating the fields.

else if dest='DFW' then output labdata. The following SAS program is submitted: proc contents data=sasuser.boston labdata. No report is produced.Airplanes b. City.airplanes. the data portion only of the data set Sasuser. libname labdata 'SAS-data-library'. REPORT c.Airplanes 18. data labdata.Airplanes d.cities(keep=orig dest city price equipment). City. the data and descriptor portions of the data set Sasuser. set sasdata. 16. the descriptor portion only of the data set Sasuser. and Equipment only 17.htm XYZ 2 A 52 3 B 70 4 A 82 b.Airplanes c. Which variables are output to both data sets? a. Price.dallas(drop=city dest equipment). the code that created the data set Sasuser. XYZ 1 B 45 2 B 69 3 B 70 4 C 91 d. TABULATE 7 of 18 10/22/2013 1:49 PM . and Equipment only d. run. The following SAS program is submitted: libname sasdata 'SAS-data-library'. Which SAS procedure displays a listing of the observations in the data portion of a SAS data set? a. The PRINT procedure fails because the data set Two is not created in the DATA step. XYZ 1 A 27 1 B 45 2 A 52 2 B 69 3 B 70 4 A 82 4 C 91 c. What is produced as output? a. run.com/edu/OLTRN/61030/m0001/base9quiz.boston. City and Equipment only c. if dest='BOS' then output labdata. FSLIST b. Price.SAS Certification Practice Exam: Base Programming https://support. Orig.dallas.sas. Price and Orig only b.

data work. c.airports. by name descending. Payroll is re-created in sorted order by EmployeeIDNumber. b. AirportCode='ord'. Which one of the following SAS programs creates a variable named City with a value of Chicago? a. AirportCode='ORD'. run. AirportCode='ORD'. AirportCode='ORD'.airports. b. run. The following SAS program is submitted: proc sort data=work. if AirportCode='ORD' City='Chicago'. and a new data set Payroll is created in sorted order by EmployeeIDNumber. run. and a new data set Payroll is created in sorted order by EmployeeIDNumber. run.com/edu/OLTRN/61030/m0001/base9quiz.Test data set by Name in descending order? a. data work. 8 of 18 10/22/2013 1:49 PM . Which of the following statements completes the program and sorts the Work. d. CONTENTS 19. c. data work. data work. The following SAS program is submitted: proc sort data=payroll. d. <insert statement here> run. by desc name. How are the observations sorted? a.SAS Certification Practice Exam: Base Programming https://support.Test are ordered by the values of the variable Salary. 21.test. by EmployeeIDNumber. Payroll is stored in original order.htm d. Payroll is re-created in sorted order by EmployeeIDNumber. b. by name desc. 20. by descending name.sas. The observations in the SAS data set Work.airports.airports. if AirportCode='ORD' then City='Chicago'. Payroll is stored in original order. c. d. and a new data set Payrollsorted is created in sorted order by EmployeeIDNumber. if AirportCode='ORD' City='Chicago'.

then City='Chicago'. <insert statement here>. The SAS data set Employees is listed below. The following SAS program is submitted: data result. run. No observations are written to the report. 24. What is the result? a. x=upcase(lname. OriginalAmount= . 22. Which statement completes the program and creates the variable X with a value of O'Reiley? a. and Ellis only are written to the report. c. x=upcase(lname). The observations for Patel. The observations for Patel and Payne only are written to the report.count. Employees Name Salary Patel 60000 Payne 50000 Ellis Liu 55000 45000 The following SAS program is submitted: proc print data=employees. AdditionalItems=100."'").com/edu/OLTRN/61030/m0001/base9quiz. d. c. run. lname="o'reiley". x=propcase(lname). if OriginalAmount= .SAS Certification Practice Exam: Base Programming https://support. b."'").sas. where name ? 'e'.. b. x=propcase(lname. 23. TotalCount=(OriginalAmount+AdditionalItems)+0. The observation for Ellis only is written to the report. The following SAS program is submitted: data work. Payne. d. run. run. then OriginalAmount=100.htm if AirportCode='ORD'. What is the value of the Totalcount variable in the output data set? 9 of 18 10/22/2013 1:49 PM .

d.dept2(rename=(jcode=jobcode) (sal=salary)). total=sum(var1. b. 100 c.dept1 work. Which SAS program renames two variables? a. by name. 10 of 18 10/22/2013 1:49 PM . format name $CHAR12. b. $CHAR.sas. var1 + var2.SAS Certification Practice Exam: Base Programming https://support.dept rename=jcode=jobcode sal=salary. It is valid only in conjunction with a SUM function. $CHAR15. 0 b.dept1 work. What is true of the sum statement in a SAS DATA step program? a. set work. The following SAS program is submitted: data merged. The variable Name in the data set Sales has a format of $CHAR15. c. The variable Name in the data set Employee has a format of $CHAR9. 200 d. It is not valid with the SET. $CHAR12. . total=var1 + var2. set work. It does not retain the accumulator variable value from one iteration of the SAS DATA step to the next.var2). c. (missing numeric value) 25. 28. 26. $CHAR9.htm a.com/edu/OLTRN/61030/m0001/base9quiz. What is the correct form of the sum statement in a DATA step? a. d.dept2(rename=(jcode=jobcode sal=salary)). c. MERGE. and UPDATE statements. c. set work. d. b. merge employee sales. 27.dept1 work. What is the format for the variable Name in the data set Merged? a. sum var1 var2.. b. set work.dept1 work.dept2 rename=(jcode=jobcode sal=salary). d. run. It adds the value of an expression to an accumulator variable and ignores missing values.

SAS Certification Practice Exam: Base Programming https://support.13.products. Which of the following completes the program and changes the word Court to Drive in the value of the variable Address1? a. Guide to the SAS Language 31. title="Hitchhiker's Guide to the SAS Language". run. b. data output. trantab(address1. address1=<insert code here>. address1='214 London Court'. s Guid d.'Court'.'Court'. translate(address1. set one. word=substr(title.'Court'.com/edu/OLTRN/61030/m0001/base9quiz. run. Product_Number=5461.'Drive') d. Item_Reference=item||'/'||product_Number. The variable Item_reference is created with a missing value.'Court'. The variable Item_reference is created with the value 1001/5461.'Drive') c.test. run.5). run. What is the value of the variable Word in the output data set? a.month. date=put('13mar2000'd. The following SAS program is submitted: data one. The following SAS program is submitted: data work. run. Guid b. What are the type and length of the variable Date in the output data set? 11 of 18 10/22/2013 1:49 PM . ide t c. The following SAS program is submitted: data work.). The program fails to execute because of errors.ddmmyy10.'Drive') 30. Item='1001'. c. What is the result? a. 32.sas.'Drive') b. The following SAS program is submitted: data work. The variable Item_reference is not created.htm 29. d. The variable Item_reference is created with the value 1001/ 5461. transform(address1. tranwrd(address1.

run. 34. Character values are not allowed on a DO loop statement. output. b. The list of values should be in parentheses. d. The program fails to execute. The values should be separated by commas. ERROR 300-322: The symbol is not recognized and will be ignored.-----388 200 ERROR 388-185: Expecting an arithmetic operator.sas. b. 33. 35. The variable Calls has a value of 6 in the output data set. d.25.SAS Certification Practice Exam: Base Programming https://support. calls+1. do i='SUN' 'MON' 'TUES'. d. b. The values should not be in quotation marks. end. The following SAS program is submitted: data stats. c. array weekly{5} mon tue wed thu fri. set revenue. run.clients. ----. The type is character and the length is 10 bytes. The type is numeric and the length is 8 bytes. end. The type is character and the length is 8 bytes. calls+1. The variable Calls has no value. do while(calls le 6). c. What caused the error? a. The variable Calls has a value of 7 in the output data set. c. The type is numeric and the length is 10 bytes. The following SAS program is submitted: data work. calls=6.com/edu/OLTRN/61030/m0001/base9quiz. A SAS program is submitted and the following is written to the SAS log: SAS Log 178 179 data days.htm a. 180 181 182 day=i!!'DAY'. Which one of the following DO statements completes the program and processes the elements of the 12 of 18 10/22/2013 1:49 PM . <insert DO statement here> total=weekly{i}*. What is the result? a. run. The variable Calls has a value of 8 in the output data set. end.

b. define style/display width=9. c. do i=1-5. define price/sum format=dollar9. d. <insert DEFINE statement(s) here> title. Diff_sales2 d. do i=1 to 5. width=10.050 $79.htm weekly array? a. Diff_sales2.Test data set? a. Diff_sales3 only c. c. d.. define price/sum format=dollar9. where price<100000. width=10. do weekly{i}=1 to 5. Diff_sales.350 $55.250 TWOSTORY Which of the following DEFINE statements completes the program and produces the desired output? a. The following list report is generated: Style of homes CONDO Asking price $80. Diff_sales1. run. b. Diff_sales only b. The following SAS program is submitted: 13 of 18 10/22/2013 1:49 PM . Diff_sales1. Which of the variables are written to the Work. do weekly=1 to 5. define style/group width=9. define style/order width=9. define price/sum format=dollar9.SAS Certification Practice Exam: Base Programming https://support.com/edu/OLTRN/61030/m0001/base9quiz. width=10.test. array diff_sales{3}. 36. 38.sas. define price/sum format=dollar9.850 $69. The following SAS program is submitted: proc report data=work. width=10. The following program is submitted: data work. Diff_sales3 37.houses nowd. run. column style price.

39.5 price $80.0 $569.0 $110.0 $107.SAS Certification Practice Exam: Base Programming https://support. proc print data=houses. <insert SAS statement(s) here> run. d.5 2. 3 d. How many tables are generated? a. The following list report is generated: style CONDO bedrooms baths 2 3 4 2 4 2 2 4 1.htm proc sort data=houses. The SAS data set Class has two character variables and three numeric variables.sas.5 $102.250 1. by style. by style.houses mean.700 3.150 2. 14 of 18 10/22/2013 1:49 PM . by style. 5 40. 0 b.950 Which of the following SAS statements completes the program and creates the desired report? a. run. var style bedrooms baths price. id style. 2 c.250 2.com/edu/OLTRN/61030/m0001/base9quiz. run. id style. id style. id style. b. var bedroom baths price. var bedrooms baths price.5 $127. The following SAS program is submitted: proc means data=sasuser.850 TWOSTORY 1.050 $79. The following SAS program is submitted: proc freq data=class.0 $55. var style bedrooms baths price.350 2. c.

class bedrooms baths. 15 of 18 10/22/2013 1:49 PM .6666667 baths Number of bathrooms 1.2500000 baths Number of bathrooms 2. 5 d. The following report is produced: style CONDO RANCH SPLIT TWOSTORY N Obs Variable Label Mean 4 bedrooms Number of bedrooms 2. proc means data=sasuser.htm <insert statement(s) here> run.0000000 baths Number of bathrooms 1. Which one of the following statements describes creating user-defined formats with the FORMAT procedure? a.houses. var style.1250000 4 bedrooms Number of bedrooms 2. run. b. class style.8333333 4 bedrooms Number of bedrooms 3.html'. class style. The following SAS program is submitted: ods html file='newfile. The report created by the PRINT procedure generates five pages of output. run. c.com/edu/OLTRN/61030/m0001/base9quiz. 43. proc print data=sasuser. 2 c.0000000 3 bedrooms Number of bedrooms 2. User-defined formats cannot end in a number. The format name can end with a period in the value statement. The format name can be up to 200 characters in length. d.8750000 Which of the following statements completes the program and creates the desired report? a. d. 41. 6 42. var bedrooms baths. c.7500000 baths Number of bathrooms 2.sas.SAS Certification Practice Exam: Base Programming https://support. b. var bedrooms baths. The following SAS program is submitted: options pageno=1 number. 1 b. What is the page number on the first page that is generated by the MEANS procedure? a. User-defined formats can share a name with a SAS format if they are stored in a different location.shoes.

The variable Description with a length of 8 bytes is created.600 26. b.SAS Certification Practice Exam: Base Programming https://support. c. proc print data=sasuser. the EXPORT statement d.700 35. run. 4 44.com/edu/OLTRN/61030/m0001/base9quiz. proc freq data=sasuser. the HTML statement c. What is the result? a. The following SAS program is submitted: data test.flts_pts. The variable Job_code is a character variable with a length of 6 bytes.000 Herman S Marty S 16 of 18 10/22/2013 1:49 PM . run. set ia. the ODS HTML statement b. The variable Description is not created. ods html close.houses.htm proc print data=sasuser. The variable Description with a length of 6 bytes is created. run. The DATA step fails because of errors. d.Salaries data set are shown below.houses. 46.shoes. run. The variables Description with a length of 16 bytes is created.sas. run. 2 c. Variable Type Len Pos name salary status Char 8 Char 8 Char 8 0 16 8 name Liz status salary S 15. the PRINTTO statement 45. 3 d. Which statement directs output to an HTML file? a. length description 8. if job_code='fltat3' then description='Flight Attendant'. How many HTML files are created? a. proc means data=sasuser. The descriptor and data portions of the Work.shoes. 1 b.

A DATA step is submitted and a portion of the SAS log is shown below. cnt+1. What is the result? a.com/edu/OLTRN/61030/m0001/base9quiz. retain monthsales{12}. Use a PUT function to write the Salary values with leading zeroes in a DATA step before the PRINT step. c. by quarter. d. if first. c.Allmonths contains four quarters of data. Change 20000 (which is a numeric constant) to '20. 17 of 18 10/22/2013 1:49 PM . set work. b. where salary<20000.Monthlysales has one observation per month for each of five years for a total of 60 observations. The program runs without errors or warnings and creates the Work. The program runs with warnings and creates the Work. title 'Jane"s Dog'. monthsales{i}=sales. title 'Jane' ' 's Dog'l 49.Totalsales data set with 60 observations. c. title "Jane's Dog".monthlysales(keep=year product sales). The data set named Work. 47.Totalsales data set with 60 observations. Which of the following answers would result in a report of individuals with Salary less than $20. run. 48. d. array monthsales{12}. monthsales{cnt}=sales.SAS Certification Practice Exam: Base Programming https://support.allmonths(keep=quarter num_sold). run.sas. The program fails execution because of data errors.htm The following SAS program is submitted: proc print data=work. title "Jane"s Dog". array sold{3}. b. The following SAS program is submitted: data work.000 upon re-execution of the program? a.totalsales. do i=1 to 12. Right justify the Salary value in the WHERE statement in the PRINT step. SAS Log 208 209 210 211 212 data arrays.000' (which is a character constant) in the WHERE statement in the PRINT step. Change the < operator to the le operator in the WHERE statement in the PRINT step.quarter then cnt=1. The program fails execution because of syntax errors.salaries. end. d. set work. The data set Work. No observations are output. b. Which one of the following TITLE statements displays Jane's Dog as the title of SAS output? a.

quarter=1 sold1=. run. run.ARRAYS may be incomplete.ARRAYS was not replaced because this step was stopped. Cary.quarter then output. The following SAS program is submitted: data test. NOTE: DATA statement used: real time 0. sold2=. sold3=. When this step was stopped there were 1 observations and 6 variables. Sort the Work. infile 'file-specification'.quarter=0 LAST.htm 213 214 215 216 sold{cnt}=num_sold. d.com/edu/OLTRN/61030/m0001/base9quiz. _NUMERIC_ d. _N_ b. All rights reserved. cnt=4 _ERROR_=1 _N_=7 NOTE: The SAS System stopped processing this step because of errors.Allmonths data set in descending order by the Quarter variable. if last.Allmonths data set to limit values of the variable Cnt to 3 or less.10 seconds Which of the following answers would correct the error message? a.sas.ALLMONTHS.SAS Certification Practice Exam: Base Programming https://support. 50. cnt+1. ERROR: Array subscript out of range at line 213 column 4. b. quarter=2 num_sold=3 FIRST. c. USA. WARNING: The data set WORK. input country $ amount. Increase the ARRAY dimension to a value of 4. Which one of the following automatic variables can be used to test whether a value for the variable Amount is non-numeric? a. NC. 18 of 18 10/22/2013 1:49 PM . _CHARACTER_ Copyright © 2008 SAS Institute Inc. WARNING: Data set WORK.. Add a WHERE= data set option to the Work. NOTE: There were 8 observations read from the dataset WORK. _ERROR_ c. Reverse the order of lines 213 and 214.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.