Wednesday, July 29, 2009

sas certification sample questions-part3

32. Which TITLE statement would display JANE'S DOG as the text of the
title?
a. title "JANE"S DOG";
b. title 'JANE"S DOG';
c. title "JANE'S DOG";
d. title 'JANE' ' 'S DOG';
Correct answer: ccc
The title in a TITLE statement must be enclosed in a pair of matched
quotation marks. Unbalanced quotation marks can cause problems for SAS.
To hide an unmatched single quotation mark, surround the title text with
matched double quotation marks.You can learn about e the TITLE
statement in Creating List Reports e unbalanced quotation marks in Editing
and Debugging SAS Programs.

33. The following SAS program is submitted:
data test;
input animal1 $
animal2 $ mlgrams1 mlgrams2;
cards;
hummingbird ostrich 54000.39
90800000.87;run;
Which one of the following represents the values of each
variable in the output data set?
a. animal1 animal2 mlgrams1
mlgrams2
hummingb ostrich 54000.39 90800000
b. animal1 animal2 mlgrams1 mlgrams2
hummingb ostrich 54000.39 90800000.87
c. animal1 animal2 mlgrams1 mlgrams2
hummingbird ostrich 54000.39 90800000
d. animal1 animal2 mlgrams1 mlgrams2
hummingbird ostrich 54000.39 90800000.87
Correct answer: bbb
The CARDS statement is an alias for the DATALINES statement. In the
INPUT statement, you must specify a dollar sign ($) 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 e the DATALINES statement in Creating SAS Data Sets from Raw
Data e the INPUT statement in Reading Free-Format Data e the default
storage length for variables in Basic Concepts.

34. The SAS data sets Work.Employee and Work.Salary are shown below.
Work.Employee
fname age
Bruce 30
Dan 40
Work.Salary
fname 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 last.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
last.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 last.fname then output;run;
d. data work.empdata; merge work.employee work.salary; by
fname; if first.fname then total+salary;run;
Correct answer: bbb

The MERGE and BY statements allow you to match-merge two or more
SAS data sets. The BY statement creates two temporary variables,
First.Fname and Last.Fname for BY group processing. The SUM statement is
used to add salary for each BY group. The variable on the left side of the plus
sign is the variable that is retained and has an initial value of 0. The
expression on the right side of the plus sign is added to the variable on the
left side of the plus sign to create a grand total. The accumulating variable,
totsal, is reset back to 0 when you encounter a new BY group value
(First.Fname is true). To output just the totals for each BY group, use the
explicit OUTPUT statement when you reach the last occurrence of each
Fname value.You can learn about the MERGE statement, the BY statement
and match-merging in Combining SAS Data Sets.

35. The contents of the SAS data set Sasdata.Group are listed below.
name age
Janice 10
Henri 11
Michele 11
Susan 12
The following SAS program is submitted using the Sasdata.Group data set as
input:
libname sasdata 'SAS-data-library';data group; set sasdata.group;
file 'file-specification'; put name $15. @5 age 2.;run;Which one of the
following describes the output created?
a. a raw data file only
b. a SAS data set named Group only
c. both a SAS data set named Group and a raw data file
d. The program fails execution due to errors.
Correct answer: ccc
The DATA step creates a temporary data set named Group and reads
data from the permanent SAS data set named Sasdata.Group into it. The
FILE statement creates a raw data file by writing out values for the variables
Name and Age to the file that is specified within the quotation marks.You can
learn about e temporary data sets in Basic Concepts e the FILE statement
in Creating SAS Data Sets from Raw Data.
36. The SAS data set Employee_info is listed below.
employee bonus
2542 100.00
3612 133.15
2198 234.34
2198 111.12
The following SAS program is submitted:
proc sort data=employee_info;
run;Which one of the following BY statements
completes the program and sorts the data in sequential order by descending
bonus values within ascending employee values?
a. by descending bonusemployee;
b. by employee bonus descending;
c. by employee descending bonus;
d. by descending employee bonus;
Correct answer: ccc
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
d. The value cannot be determined because the program fails to execute
due 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;
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;
d. 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=
d. 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
statement.You can learn about the FILE= option in the ODS HTML statement
in Producing HTML Output.

40. The following SAS program is submitted:
data work.test;
set sasuser.class;
array t{3} (5, 10, 15);
run;
Which one of the following completes the ARRAY statement and creates data elements that are not included in the SAS data set Work.Test? a. _DROP_
b. _TEMP_
c. _TEMPORARY_
d. No extra text is needed.
Correct answer: ccc
_TEMPORARY_ is a keyword used in the ARRAY statement to create
temporary data elements. By default, the ARRAY statement creates new data
set variables or references existing variables for use by the array.You can
learn about the _TEMPORARY_ keyword and the ARRAY statement in
Processing Variables with Arrays.
41. 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 the raw data 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;
Which one of the following is the result?
a. The program executes, but the age values are missing in the output.
b. The program executes, but the date values are missing in the output.
c. The program fails to execute because the age informat is coded
incorrectly.
d. The program fails to execute because the date informat is coded
incorrectly.
Correct answer: aaa
Values for the variable age are missing in the output because the
informat for age is coded incorrectly. Since age is standard numeric input, it
should use the w.d informat to specify a field width of 3 in the INPUT
statement.You can learn about the w.d informat in Reading Raw Data in
Fixed Fields.
42. Assume that SAS data sets Sasdata.Products and Sasdata.Sales both
contain the Prod_ID variable. Which of the following SAS DATA steps returns
only exceptions or non matches?
a. libname sasdata 'SAS-datalibrary';
data all; merge sasdata.products sasdata.sales; by prod_id;
if ins=1 or inp=1;run;
b. libname sasdata 'SAS-data-library';data all; merge
sasdata.products(in=inp) sasdata.sales(in=ins); by prod_id; if ins=1
and inp=1;run;
c. libname sasdata 'SAS-data-library';data all; merge
sasdata.products(in=inp) sasdata.sales(in=ins); by prod_id; if ins=0
and inp=0;run;

d. libname sasdata 'SAS-data-library';data all; merge
sasdata.products(in=inp) sasdata.sales(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 0, 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 0.You can learn about the IN= data set option
in Combining SAS Data Sets.

43. The following SAS program is submitted:
libname sasdata 'SAS-datalibrary';
libname labdata 'SAS-data-library';
data labdata.boston labdata.dallas(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 labdata.dallas;
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 that 5 variables
(orig, dest, city, price, and equipment) are read from the input data set. All
of these variables are output to Labdata.Boston. In the Labdata.Dallas output
data set, the DROP= option specifies that city, dest, and equipment are
excluded from the data set so that only orig and price are included.You can
learn about the KEEP= option in Creating and Managing Variables.

44. The following SAS program is submitted:
proc contents data=sasuser._all_ nods;
run;
Which one of the following is produced as output?
a. the list of all data set names in the Sasuser library only
b. the descriptor portion of the data set named Sasuser._All_
c. the descriptor portion of every data set in the Sasuser library only
d. the list of data set named in the Sasuser library plus the descriptor
portion of every data set in the Sasuser library.
Correct answer: aaa
You can use the CONTENTS procedure to create SAS output that
describes the contents of a library. _ALL_ requests a listing of all files in the
library, and NODS suppresses the printing of detailed information about each
file in the output.You can learn about the CONTENTS procedure in
Referencing Files and Setting Options.

45. The following SAS program is submitted:
data work.test;
length city$20;
city='Paris';
city2=trim(city);
run;
Which one of the following is then length of the city2 variable?
a. 5
b. 6
c. 8
d. 20
Correct answer: ddd
The LENGTH statement specifies that the variable city has a length of
20 characters. The TRIM fSAS Guidetion in the assignment statement for
city2 removes trailing blanks from the value. However, the length of the city2
variable is set to 20 because city has a length of 20, and SAS pads the
trimmed value with extra blanks.You can learn about e the LENGTH
statement in Reading Free-Format Data e the TRIM fSAS Guidetion in
Transforming Data with SAS FSAS Guidetions.

46. A raw data record is listed below. 1---+----10---+----20---+---
$23,456 750
The following SAS program is submitted: data bonus; infile 'filespecification';
input salary $ 1-7 raise 9-11; here>run;Which one of the following statements completes the program and
adds the values of salary and raise to calculate the expected values of the
newsalary variable?
a. newsalary=salary + raise;
b. newsalary=put(salary,comma7.) + raise;
c. newsalary=input(salary,comma7.) + raise;
d. newsalary=put(salary,comma7.) + put(raise,3.);
Correct answer: ccc
You must convert the value of salary from character to numeric in
order to perform an arithmetic fSAS Guidetion on it. You use the INPUT fSAS
Guidetion to convert a character value to a numeric value.You can learn
about the INPUT fSAS Guidetion in Transforming Data with SAS FSAS
Guidetions.
47. The following SAS program is submitted:
data work.travel;
do i=1 to 6 by 2;
trip + i;
end;
run;
Which one of the following is the value of the
variable trip in the output data set?
a. 2
b. 3
c. 9
d. 10
Correct answer: ccc
The sum variable in a sum statement is automatically set to 0 before
the first observation is read from the data set. The sum variable in the
statement above is increased by the value of i on each iteration of the DO
loop; the value of i is set to 1 on the first iteration of the DO loop and
increases by 2 on each additional iteration until it is greater than 6.
Therefore, the value of Trip is equal to 0 + 1 + 3 + 5, which is 9.You can
learn about e the sum statement in Creating and Managing Variables e DO
loops in Generating Data with DO Loops.

48. The following SAS program is submitted:
proc report data=survey nowd;
column age choice1;

Define choice1/display;run;
Which one of the following DEFINE statements completes
the program and displays values of the variable Age in ascending order?
a. define age/sort;
b. define age/order;
c. define age/sort by age;
d. define age/order by age;
Correct answer: bbb
You use a DEFINE statement to describe how to order and use
variables in your report. To specify Age as an order variable, you use the
ORDER usage option in the DEFINE statement. An order variable orders the
detail rows in a report according to their formatted values. By default, the
order is ascending.You can learn about the DEFINE statement and order
variables in Creating Enhanced List and Summary Reports.

49. Which one of the following statements is true when SAS encounters a
data error? a. The execution phase is stopped, and a system abend
occurs.
b. A missing value is assigned to the appropriate variable, and execution
continues.
c. The execution phase is stopped, and a SAS data set is created with
zero observations.
d. A missing value is assigned to the appropriate variable, and execution
stops at that point.
Correct answer: bbb
Unlike syntax errors, invalid data errors do not cause SAS to stop
processing a program. SAS handles invalid data errors by assigning a missing
value to the appropriate variable and writing a message to the SAS log.You
can learn about how SAS handles invalid data errors in Creating SAS Data
Sets from Raw Data.
50. The following SAS program is submitted:
data test;
input country $8.
date mmddyy10.;
cards;
Germany 12/31/2000France 01/32/2001;run;Which
one of the following is the value of the variable _ERROR_ when the variable
_N_ has a value of 2?
a. 0
b. 1
c. true
d. false
Correct answer: bbb

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