EPOCH RESEARCH INSTITUTE (GUJ) PVT. LTD.BASE SAS CERTIFICATION EXAM Name of Student:______________________________ Test Taken By: ______________________________ Test Date: ______________________________________ Total Marks: _________________________________ Score: __________________________________________ Instruction: Please read question carefully before you attempt it. Total marks: 55(Each carry 1 mark, and carries 0.25 negative marking system.) Passing percentage: 65% Total Time: 1 hour and 30 min. 1)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; a. The PROC PRINT step runs successfully, printing observations in their sorted order. b. The PROC SORT step permanently sorts the input data set. c. The PROC SORT step generates errors and stops processing, but the PROC PRINT step runs successfully, printing observations in their original (unsorted) order. d. The PROC SORT step runs successfully, but the PROC PRINT step generates errors and stops processing. 2)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; Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No.004/9th April 2010 Page 1 source: SAS Certification Prep Guide: Base Programming for SAS 9 02 48 $5.000 $325.000 $325.000 $128.200 $1.52 48 $5.000 $325.165.47 36 $10.000 $128.500 $308.52 24 $8.000 $128.02 27.47 36 $10. Months Amount Payment 12 $3.52 24 $8.52 24 $8.47 36 $10.500 $308.200 1.004/9th April 2010 Page 2 source: SAS Certification Prep Guide: Base Programming for SAS 9 .02 24 $8.000 $325.700 $403.03 Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No.165.000 $128.47 36 $10.165.500 $308.02 48 $5.165.03 b.700 $403.a.03 d.700 $403. Months Amount Payment 12 $3.02 $1.02 48 $5.02 $27. Months Amount Payment 12 $3.02 $27.200 $1. Months Amount Payment 12 $3.500 $308.700 $403.03 c. 4)What does PROC PRINT display by default? a. If you want an additional column for observation numbers. you must specify the rows and columns to be displayed.salesrep. PROC PRINT displays all observations and variables in the data set. Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. where (amount le 5000 and account='101-1092') or rate = 0.095.095. b.004/9th April 2010 Page 3 source: SAS Certification Prep Guide: Base Programming for SAS 9 . and variables in the order in which they occur in the data set. c. run. PROC PRINT displays columns in the following order: a column for observation numbers. all character variables. infile empdata. run. a column for observation numbers on the far left. c. and all numeric variables. d. data work.salesrep. PROC PRINT displays all observations and variables in the data set. a.095). where amount <= 5000 and account='101-1092' or rate = 0. proc print data=work. input ID $ 1-4 LastName $ 6-12 FirstName $ 14-18 City $ 20-29.095. where amount <= 5000 and (account='101-1092' or rate eq 0. b. or the rate equals 0. where amount <= 5000 or account='101-1092' and rate = 0. d.095. PROC PRINT does not create a default report.3)Choose the statement below that selects rows in which the amount is less than or equal to $5000 the account is 101–1092. 5)Which program creates the output shown below? Obs ID LastName FirstName City 1 3427 Chen Steve Raleigh 2 1436 Davis Lee Atlanta 3 2812 King Vicky Memphis 4 1653 Sanchez Jack Atlanta a. you can request it. data set variables will contain missing values. proc print data=work. such as 24 or 'S'. missing or misspelled keywords 7) If SAS cannot interpret syntax errors. run. Which of the following is not considered a syntax error? a. 9) Which of these is false? Ranges in the VALUE statement can specify a. SAS scans each statement in the DATA step.salesrep. infile empdata. run.180. such as 0–1500.salesrep. incorrect values and formats b. d. d.salesrep. all of the above 6) During the compilation phase. the DATA step still compiles and executes. looking for syntax errors. run. input ID $ 1-4 Name $ 6-12 FirstName $ 14-18 City $ 20-29. b. the DATA step still compiles. 8) When creating a format with the VALUE statement. such as 'A'–'M'. run. c. missing or invalid punctuation d. such as 90. c. data work.270. a range of numeric values. a list of numeric and character values separated by commas.004/9th April 2010 Page 4 source: SAS Certification Prep Guide: Base Programming for SAS 9 . a single value. must be at least eight characters long. input ID $ 1-4 name1 $ 6-12 name2 $ 14-18 City $ 20-29. d. cannot be the name of a data set variable.'B'. d. but it does not execute. proc print data=work. the DATA step does not compile. data work. c. then a. invalid options or variable names c. a range of character values.salesrep. must be at least two characters long. c. infile empdata. b.b. and a. must begin with a dollar sign ($) if used with a character variable.'D'. the new format's name cannot end with a number cannot end with a period cannot be the name of a SAS format. Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. b. d. PROC FREQ creates a table of frequencies and percentages for which data set variables? a. run. BY variables must be either indexed or sorted. BY-group processing is preferred when you are categorizing data that contains few variables. You temporarily associate the formats with variables. Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. 13)By default. You permanently associate the formats with variables. tables sex weight / list. tables sex*weight / nocol. none: variables must always be specified 14)Which PROC FREQ step produced this table? a) proc freq data=clinic. Which FORMAT statement will apply it to the variable JobTitle in the program output? a. c. b. b. both character and numeric variables d. format jobtitle='jobfmt'. b.004/9th April 2010 Page 5 source: SAS Certification Prep Guide: Base Programming for SAS 9 . format weight wtfmt. What happens when you place the FORMAT statement in a DATA step? a.. numeric variables c. d. format jobtitle jobfmt. b) proc freq data=clinic. character variables b.. run. format jobtitle=jobfmt. c. format weight wtfmt. 12)Which of the following statements is true regarding BY-group processing? a. 11)The format JOBFMT was created in a FORMAT procedure. You replace the original data with the format labels. BY-group processing overwrites your data set with the newly grouped observations.diabetes. Summary statistics are computed for BY variables. d. c..diabetes.10)You can place the FORMAT statement in either a DATA step or a PROC step. You make the formats available to other data sets. format jobtitle jobfmt. infile creddata.html. label amount='Amount of Loan'. and listing d.html contain? ods html body='d:\output\body. run. HTML.html'. run. a. The PROC PRINT output for Work..Alpha. The PROC PRINT output for Work. format weight wtfmt. No output will be written to D:\Output\body. ods html close. tables sex*weight / nofreq norow nocol. HTML and PDF b. b. 15)If ODS is set to its default settings. proc print data=work.2. Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No.004/9th April 2010 Page 6 source: SAS Certification Prep Guide: Base Programming for SAS 9 .htm'. d.diabetes.Beta.pdf'. what types of output are created by the code below? ods html file='c:\myhtml. No output is created because ODS is closed by default. 16)When the code shown below is run. 17)How is the variable Amount labeled and formatted in the PROC PRINT output? data credit.. The PROC PRINT output for both Work. tables sex weight / norow nocol. PDF only c.c) proc freq data=clinic. what will the file D:\Output\body. ods pdf file='c:\mypdf.alpha. a.beta.Beta. run.diabetes. format amount dollar12. input Account $ 1-5 Name $ 7-25 Type $ 27 Transact $ 29-35 Amount 37-50. proc print data=work.Alpha and Work. PDF. c. Nothing. run. d) proc freq data=clinic. format weight wtfmt. run. label Amount of Loan. a. 100 d. the LENGTH statement d. label amount='Total Amount Loaned'. if status='S' or action='E' then Control='Stop'..proc print data=credit label. format DOLLAR12. all of the above 19)For the observation shown below. what is the result of the IF-THEN statement? Status Type ok 3 Count 12 Action Control E Go if status='OK' and type=3 then Count+1. 130 Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. default format d. Count = 12 b. 18)Which of the following can determine the length of a new variable? a.2 b. the assignment statement c. The PROC PRINT step does not execute because two labels and two formats are assigned to the same variable. Count = 13 Control = Go Control = Stop Control = Stop Control = Go 20)What is the value of Count after the third observation is read? a. run. label Amount. the length of the variable's first value b. label Total Amount Loaned. Count = 12 d.004/9th April 2010 Page 7 source: SAS Certification Prep Guide: Base Programming for SAS 9 . c. a. format amount comma10. missing b. Count = 13 c. format COMMA10. 0 c. an error b.orders(keep=product units price ordrtime).fastordr(drop=ordrtime). run. if last. for each variable in the BY statement. run. Total=units*price. and LAST. FIRST. a. Total=units*price.21)Which of the following programs correctly reads the data set Orders and creates the data set FastOrdr? a) data catalog. set clinic. c) data catalog. b.addtoend. if ordrtime<4. data set that contains one observation Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. and LAST. a continuous loop d.fastordr(keep=product units price). FIRST. c. if ordrtime<4. the DATA step automatically creates two variables. are stored in the data set. run. an empty data set c.fastordr(drop=ordrtime). 23)What is the result of submitting the following program? data work. in that order. and LAST. run. set july. set july. a. the data sets that are listed in the SET statement must be indexed or sorted by the values of the BY variable(s). if ordrtime<4. FIRST. set july.004/9th April 2010 Page 8 source: SAS Certification Prep Guide: Base Programming for SAS 9 .stress2 end=last. d.orders(drop=ordrtime). d) none of the above 22)Which of the following statements is false about BY-group processing? When you use the BY statement with the SET statement.. identify the first and last observation in each BY group. b) data catalog. Total=units*price.orders(keep=product units price). 1).1.4.1. Which MDY function creates the date value for January 3.3. d.20) b. Which statement correctly converts the values of SiteNum to character values when creating the variable Location? a. Location=dept||'/'||input(sitenum. What happens when the following program is run? data work. how many observations does the new data set contain? a. d. Hours to character values.temp.1). b.1).1). SAS converts the values of SAS converts the values of SAS converts the values of SAS converts the values of PayRate to numeric values.Staff2 below by ID.3.004/9th April 2010 Page 9 source: SAS Certification Prep Guide: Base Programming for SAS 9 .20) c. run. 27)Suppose the YEARCUTOFF= system option is set to 1920. No message is written to the log. c. A message is written to the log.3.2020) Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. c. No message is written to the log. 26)A typical value for the numeric variable SiteNum is 12. d.3. MDY(3. MDY(1. Location=dept||'/'||input(sitenum. MDY(3. PayRate to numeric values.2020) d. MDY(1. b. a.24)If you merge Company.Temp. PayRate is a character variable and Hours is a numeric variable. Salary=payrate*hours. A message is written to the log.4.3.temp.Staff1 and Company. 2020? a. Location=dept||'/'||put(sitenum. set hrd. 4 5 6 9 25)Within the data set Hrd. Hours to character values. b. c. Location=dept||'/'||put(sitenum. How many times does this DO loop execute? data finance. d. They can be used to combine DATA and PROC steps.000 is invested in an account. do count=1 to capital.075/12. . run. do count=capital to (capital*. d. They can contain conditional clauses. b. c. b. b. d.28)The variable Address2 contains values such as Piscataway. Rate=.004/9th April 2010 Page 10 source: SAS Certification Prep Guide: Base Programming for SAS 9 .13.invest.earnings.2). Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. $5. end. NJ. Capital+5000. Amount=1000. do count=1 to 15 by 10%. c. data work. Earned+(amount+earned)*rate.10). 12 d. do count=1 to 15. 13 31)On January 1 of each year. the value of Earned is calculated and is added to its previous value. c.2).13.10). State=substr(address2. They can generate multiple observations. a. State=substr(address2. 30)During each execution of the following DO loop.. run.2). State=scan(address2.. Complete the DATA step below to determine the value of the account after 15 years if a constant interest rate of 10% is expected. a. How do you assign the two-letter state abbreviations to a new variable named State? a. 1 c. capital+(capital*. do month=1 to 12. end. 0 b. 29)Which statement is false regarding the use of DO loops? a. They can be used to read data. State=scan(address2.2). c. do year=1 to 20. 19 d. do year=1990 to 2004. Value=2000. do year=1990 to 2004. end. end.10). b. run.Earn contain? data work. a. 34)How many observations will the data set Work.004/9th April 2010 Page 11 source: SAS Certification Prep Guide: Base Programming for SAS 9 . 20 Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. The stored value for Year is 2005.invest.invest. end. value+interest. d. run. a. 0 b. capital+(capital*. d. a. Interest=value*.earn.Invest.32)In the data set Work. b. The DO loop performs 15 iterations. what would be the stored value for Year? data work.075. missing 1990 2004 2005 33)Which of the following statements is false regarding the program shown below? data work. output. Capital+5000.10). The OUTPUT statement overrides the automatic output at the end of the DATA step. c. The OUTPUT statement writes current values to the data set immediately. 1 c. Capital+5000. output. run. capital+(capital*. c. when(Distance>250) c. end. run. Year+1. Distance=gallons*mpg.000 a year for five years in three different banks that compound interest monthly? Assume a fixed rate for the five-year period. DO UNTIL statement d. DO WHILE statement b. do until(Capital gt 500000).35)Which of the following would you use to compare the result of investing $4. set perm. do while(Capital<500000). data work. b. d. complete the statement so that the program stops generating observations when Distance reaches 250 miles or when 10 gallons of fuel have been used. run. while(Distance<250) b. output.go250. do while(Capital le 500000).004/9th April 2010 Page 12 source: SAS Certification Prep Guide: Base Programming for SAS 9 . end. a. do while(Capital ge 500000). 37)In the following program. a.cars. do gallons=1 to 10 . data work. over(Distance le 250) d. a DO group 36)Select the DO WHILE statement that would generate the same result as the program below.invest...10). until(Distance=250) Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. nested DO loops c. capital+(capital*. do while(Capital=500000). capital=100000. . a. until i=4. d. i=1 to 4. i=1. end. quarter quarter* 1-4 4 39)For the program below.25. i=1 to dim(*).2. a. contrib{i}=contrib{i}*1. run. do do do do i=1 to dim(factors). 41)For the first observation. i=1 to 4. c..004/9th April 2010 Page 13 source: SAS Certification Prep Guide: Base Programming for SAS 9 .4. a. b. .3. what is the value of diff{i} at the end of the second iteration of the DO loop? Weight1 Weight2 Weight3 192 200 215 137 130 125 220 210 213 Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. d.contrib. array contrib{4} qtr1-qtr4. while i le 4. b. c. b. c. d. select an iterative DO statement to process all elements in the contrib array. data work. a. do do do do i=4. 40)Which DO statement would not process all the elements in the factors array shown below? array factors{*} age height weight bloodpr..38)What belongs within the braces of this ARRAY statement? array contrib{?} qtr1-qtr4. both standard and nonstandard data in fixed fields 45)Which informat should you use to read the values in column 1-5? a. d.25 c. 1/2 d. 9600. 50% 44)Formatted input can be used to read a. standard data in fixed fields c. c. a. 15 10 8 -7 42)Finish the ARRAY statement below to create temporary array elements that have initial values of 9000. c. b.234. array goal{4} . do i=1 to 9.. w. . standard free-format data b.245 b. d.004/9th April 2010 Page 14 source: SAS Certification Prep Guide: Base Programming for SAS 9 . and 9900.d COMMAw. b.. $24. w. 9300. nonstandard data in fixed fields d. $w. diff{i}=wt{i+1}-wt{i}. b.d Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. d. end.array wt{*} weight1-weight10. -34. _temporary_ (9000 9300 9600 9900) temporary (9000 9300 9600 9900) _temporary_ 9000 9300 9600 9900 (temporary) 9000 9300 9600 9900 43)Which is an example of standard numeric data? a. a. c. array diff{9}. LastName (character).. comma9.. infile salesrep dlm. 9.2. input FirstName $ 1-4 LastName $ 6-12 Age 14-15 School $ 17-19 Class 21. input input input input @17 @17 @17 @17 Cost Cost Cost Cost 7. 48)Which SAS statement should be used to read the raw data file that is referenced by the fileref Salesrep? a. b. d. infile salesrep. 47)Which SAS statement reads the raw data values in order and assigns them to the variables shown below? Variables: FirstName (character). c. c. 49)Which type of input should be used to read the values in the raw data file that is referenced by the fileref University? Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. Age (numeric).004/9th April 2010 Page 15 source: SAS Certification Prep Guide: Base Programming for SAS 9 .2. d.46)Which INPUT statement correctly reads the numeric values for Cost (third field)? a. b. b. infile salesrep dlm=':'.. d. Class (numeric) a. comma7. infile salesrep ':'. School (character). c. input FirstName $ LastName $ Age School $ Class. input FirstName LastName Age School Class. input FirstName 1-4 LastName 6-12 Age 14-15 School 17-19 Class 21. / Address $20. Address. /. input / Fname $ Lname $ / Address $20. City $ State $ Zip $. Lname.004/9th April 2010 Page 16 source: SAS Certification Prep Guide: Base Programming for SAS 9 . 1960 d. they can easily be read and understood. they can be used in calculations like other numeric values. 50)SAS date values are the number of days since which date? a. City $ State $ Zip $. they can be used in text strings like other character values. b. January 1. they can easily be edited. input Fname $ Lname $ / Address $20. 52)Which SAS statement correctly reads the values for Fname. 1950 c. c. January 1. / City $ State $ Zip $. input / Fname $ Lname $. b. column formatted list Using Modifier. d. input Fname $ Lname $ /. Address $20. d. 1900 b. 1970 51)A great advantage of storing dates and times as SAS numeric date and time values is that a. State. and Zip in order? a. c. d.a. Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. January 1. City $ State $ Zip $. b. c.. City. January 1. output.53)Which is true for the double trailing at sign (@@)? a. @. b. 54)A record that is being held by a single trailing at sign (@) is automatically released when a. output. It must be the last item that is specified in the INPUT statement. end. b. run. input Activity : $10. another INPUT statement that has a single trailing at sign (@) executes. a and b Test Code ep/Base/A00-211 Author: Krishna Nanavaty Version No: ep/No. c. end. end. @. the input pointer moves past the end of the record. d. All of the above. b. c. the next iteration of the DATA step begins. input Activity : $10. another value is read from the observation. @. d. when used in a DATA step.004/9th April 2010 Page 17 source: SAS Certification Prep Guide: Base Programming for SAS 9 . run. do choice=1 to 3. input Activity : $10. do choice=1 to 3. do choice=1 to 3. d. It is released when the input pointer moves past the end of the record. c. run. 55)Which option below. It enables the next INPUT statement to read from the current record across multiple iterations of the DATA step. writes an observation to the data set after each value for Activity has been read? a.