Monday, July 27, 2009

sas certification sample questions-part2

17. The following program is submitted:
data fltaten;
input jobcode $ salary name $;
cards;
FLAT1 70000 BobFLAT2 60000 JoeFLAT3 30000
Ann;run;
data desc; set fltaten;
if salary>60000 then description='Over60';
else description='Under 60';
run;
What is value of the variable named
description when the value for salary is 30000?
a. Under 6
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 e the
compilation phase of the DATA step in Understanding DATA Step Processing e
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 all_sales;
infile 'file-specification';
input receipts;
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
d. . (missing numeric value)
Correct answer: ddd
The variable Total is assigned a missing value during the compilation
phase of the DATA step. When the first record is read in, SAS processes:
total=.+2; which results in a missing value. Therefore the variable Total
remains missing for all observations.You can learn about e the compilation
phase of the DATA step in Understanding DATA Step Processing e using
missing values with arithmetic operators in Creating SAS Data Sets from Raw
Data.

20. The following program is submitted: data test;
average=mean(6,4,.,2);run;What is the value of average?
a. 0
b. 3
c. 4
d. . (missing numeric value)
Correct answer: ccc
The MEAN fSAS Guidetion adds all of the non-missing values and
divides by the number of non-missing values. In this case, 6 + 4 + 2 divided
by 3 is 4.You can learn about the MEAN fSAS Guidetion in Transforming Data
with SAS FSAS Guidetions.

21. The following SAS program is submitted:
data work.AreaCodes;
Phonenumber=3125551212;
Code='('!!substr(Phonenumber,1,3)!!')';run;Which one of the following is the
value of the variable Code in the output data set?
a. ( 3)
b. (312)
c. 3
d. 312
Correct answer: aaa
An automatic data conversion is performed whenever a numeric
variable is used where SAS expects a character value. The numeric variable
is written with the BEST12. format and the resulting character value is rightaligned
when the conversion occurs. In this example, the value of
Phonenumber is converted to character and right-aligned before the SUBSTR
fSAS Guidetion is performed. Since there are only 10 digits in the value of
Phonenumber, the right-aligned value begins with two blanks. Therefore the
SUBSTR fSAS Guidetion picks up two blanks and a 3, and uses the BEST12.
format to assign that value to Code. Then, the parentheses are concatenated
before and after the two blanks and a 3.You can learn about automatic data
conversion and the SUBSTR fSAS Guidetion in Transforming Data with SAS
FSAS Guidetions.

22. The following SAS program is submitted:
data work.inventory;
products=7;
do until (products gt 6); products+1;
end;
run;
Which one of the following is the value of the variable products in the output data set?
a. 5
b. 6
c. 7
d. 8
Correct answer: ddd
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);
run;
WhichARRAY statement completes the program and creates new variables?
a. array salary{3};
b. array new_salary{3};
c. array salary{3} salary1-salary3;
d. array new_salary{3} salary1-salary3;
Correct answer: bbb
Although each of the ARRAY statements listed above is a valid
statement, only Answer B creates new variables named new_salary1,
new_salary2 and new_salary3. Answer C and Answer D both create an array
that groups the existing data set variables salary1, 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 e
permanently assigning a format to a variable in Creating and Managing
Variables e the FORMAT statement in Creating List Reports e the FORMAT
procedure in Creating and Applying User-Defined Formats e the INPUT
fSAS Guidetion in Transforming Data with SAS FSAS Guidetions e 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
Which of the following steps created the report?
a. proc freq data=sasuser.houses; tables style price /nocum; format price dollar10.;
label style="Style of homes" price="Asking price";run;
b. proc print data=sasuser.houses; class style; var price; table
style,n price*mean*f=dollar10.; label style="Style of homes"
price="Asking price";run;
c. proc means data=sasuser.houses n mean; class style; var price;
format price dollar10.; label style="Style of homes" price="Asking
price";run;
d. proc report data=sasuser.houses nowd headline; column style n
price;
define style / group "Style of homes"; define price / mean
format=dollar8. "Asking price";run;
Correct answer: ddd
The FREQ procedure cannot create the average asking price. The
CLASS statement and the VAR statement are not valid for use with the PRINT
procedure. The MEANS procedure output would have both the N statistic and
the N Obs statistic since a CLASS statement is used. The REPORT procedure
produced the report.You can learn about e the FREQ procedure in
Producing Descriptive Statistics e the PRINT procedure in Creating List
Reports e the MEANS procedure in Producing Descriptive Statistics e the
REPORT procedure in Creating Enhanced List and Summary Reports.

26. A SAS report currently flows over two pages because it is too long to
fit within the specified display dimension. Which one of the following actions
would change the display dimension so that the report fits on one page?

a.Increase the value of the LINENO option.
b. Decrease the value of the PAGENO option.
c. Decrease the value of the LINESIZE option.
d. Increase the value of the PAGESIZE option.
Correct answer: ddd
The PAGESIZE= SAS system option controls the number of lines that
compose a page of SAS procedure output. By increasing the number of lines
available per page, the report might fit on one page.You can learn about the
PAGESIZE= option in Referencing Files and Setting Options.
27. Which one of the following SAS REPORT procedure options controls
how column headings are displayed over multiple lines? a. SPACE=
b. SPLIT=
c. LABEL=
d. BREAK=
Correct answer: bbb
The SPLIT= option specifies how to split column headings. The
SPACE=, LABEL= and BREAK= options are not valid options in PROC
REPORT.You can learn about the SPLIT= option for the REPORT procedure in
Creating Enhanced List and Summary Reports.

28. The following SAS program is submitted:
ods html file='newfile.html';
proc print data=sasuser.houses;run;
proc means 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
Actor I 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:
datawork.joblevels;
set work.actors;
if jobcode in ('Actor I', 'Actor II') then
joblevel='Beginner';
if jobcode='Actor III' then joblevel='Base'; else
joblevel='Unknown';run;
Which of the following represents the possiblevalues 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 e the IF
statement in Creating SAS Data Sets from Raw Data e 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
salary Char 8 16
status Char 8 8
name status salary
Liz S 15,600
Herman S 26,700
Marty S 35,000
The following SAS program is submitted:
proc print data=work.salaries;
where salary<20000;run;
What is displayed in the SAS log after the program
is executed?
a. A NOTE indicating that 1 observation is read.
b. A NOTE indicating that 0 observations were read.
c. A WARNING indicating that character values have been converted to
numeric values.
d. An ERROR indicating that the WHERE clause operator requires
compatible variables.
Correct answer: ddd
Your answer: undefinedundefinedundefined
Salary is defined as a character variable. Therefore, the value in the
WHERE statement must be the character value 20,000 enclosed in quotation
marks.You can learn about the WHERE statement in Creating List Reports.
31. Which of the following statements is true when SAS encounters a
syntax error in a DATA step?
a. The SAS log contains an explanation of the
error.
b. The DATA step continues to execute and the resulting data set is
complete.
c. The DATA step stops executing at the point of the error and the
resulting data set contains observations up to that point.
d. A note appears in the SAS log indicating that the incorrect statement
was saved to a SAS data set for further examination.
Correct answer: aaa
SAS scans the DATA step for syntax errors during the compilation
phase. If there are syntax errors, those errors get written to the log. Most
syntax errors prevent further processing of the DATA step.

Send link to --

TopBlogDir.blogspot.com button Education Blog Directory Academic,  Learning & Educational Blogs - Blog Catalog Blog Directory SEO Court Directory myblog Visit blogadda.com to discover Indian blogs Add to Technorati Favorites Subscribe with Bloglines DigNow.net

Join My Community at MyBloglog!

Free Web Directory - Add Your Link
The Little Web Directory
Monster Directory A List Sites