Click on the Comments to view the Answers
Showing posts with label datastep execution. Show all posts
Showing posts with label datastep execution. Show all posts

Wednesday, January 20, 2010

Which code would achieve the output

The SAS data set named WORK.TEST is listed below: Which one of the following SAS programs created this data set?

capacity    airplanetype     staff
-------------------------------
150           Large             10

A. data work.test;
capacity = 150;
if 100 le capacity le 200 then airplanetype = 'Large' and staff = 10; else airplanetype = 'Small' and staff = 5; run;

B. data work.test;
capacity = 150;
if 100 le capacity le 200 then do;
airplanetype = 'Large';
staff = 10;
end; else do;
airplanetype = 'Small';

staff = 5;
end;
run;

C. data work.test;
capacity = 150;
if 100 le capacity le 200 then do;
airplanetype = 'Large';
staff = 10;
else do;
airplanetype = 'Small'; airplanetype = 'Small';
staff = 5;
end;
run;

D. data work.test;
capacity = 150;
if 100 le capacity le 200 then;
airplanetype = 'Small'; airplanetype = 'Small';
staff = 5;
else;
airplanetype = 'Large'; airplanetype = 'Large';
staff = 10;
run;

Check the comments for answers...

what is value of the variable

The following SAS program is submitted:

data work.flights;
destination = 'CPH';
select(destination);
when('LHR') city = 'London';
when('CPH') city = 'Copenhagen';
otherwise;
end;
run;

Which one of the following is the value of the CITY variable?

A. London
B. Copenh
C. Copenhagen
D. ' ' (missing character value)

Check the comments for answers...

first. and last. execution

The following SAS program is submitted:

data work.total;
set work.salary(keep = department wagerate);
by department;
if first.department then payroll = 0;
payroll + wagerate;
if last.department;
run;

The SAS data set WORK.SALARY, currently ordered by DEPARTMENT, contains 100 observations for each of 5 departments. Which one of the following represents how many observations the WORK.TOTAL data set contains?


A. 5
B. 20
C. 100
D. 500

Datastep Execution - character

The following SAS program is submitted:

libname sasdata 'SAS-data-library';

data test;
set sasdata.chemists;
if jobcode = 'chem3'
then description = 'Senior Chemist';
else description = 'Unknown';
run;

A value for the variable JOBCODE is listed below:

JOBCODE
---------------
 CHEM3

Which one of the following values does the variable DESCRIPTION contain?

A. chem3
B. Unknown
C. Senior Chemist
D. ' ' (missing character value)

Check the comments for answers...

Datastep Execution

The following SAS program is submitted:

data work.new;
length word $7;
amount = 4;
if amount = 4 then word = 'FOUR';
else if amount = 7 then word = 'SEVEN';
else word = 'NONE!!!';
amount = 7;
run;

Which one of the following represents the values of the AMOUNT and WORD variables?

      Amount            Word
------------------------------
a)   7                       FOUR
b)   7                       SEVEN
c)    4                      FOUR
d)   4                       ' ' (missing character values)

Check the comments for answers...

temporary library or permanent

The following SAS DATA step is submitted:

libname temp 'SAS-data-library';
data temp.report;
set sasuser.houses;
newvar = price * 1.04;
run;

Which one of the following statements is true regarding the program above?

A. The program is reading from a temporary data set and writing to a temporary data set.
B. The program is reading from a temporary data set and writing to a permanent data set.
C. The program is reading from a permanent data set and writing to a temporary data set.
D. The program is reading from a permanent data set and writing to a permanent data set.

Check the comments for answers...

SAS encounters a data error in a DATA step

Which one of the following is true when SAS encounters a data error in a DATA step?

A. The DATA step stops executing at the point of the error, and no SAS data set is created.
B. A note is written to the SAS log explaining the error, and the DATA step continues to execute.
C. A note appears in the SAS log that the incorrect data record was saved to a separate SAS file for further examination.
D. The DATA step stops executing at the point of the error, and the resulting DATA set contains observations up to that point.

Check the comments for answers...

Datastep Execution

Review the code below

data aaa;
infile cards missover;
input num1 num2 num3 num4;
cards;
11 12
31 32 33 34
;

What are the values of num1-num4 in the first observation of dataset aaa?

a) 11 12 31 32
b) 11 12 missing missing
c) missing missing missing missing
d) An error is issued by SAS and dataset is not created.

Check the comments below for answers....

Datastep Execution

data x;
set a;
length name $ 5;
retain name 'David';
do i=1 to 5;
initial = substr(name,1,1);
end;
if initial .ne. 'D' then delete;
run;

How many times is this data step executed based on the datasets below?

data a
--------
name age
Bob   35
Jason 57
John  79

data b
-------
name  age
Bob    2
Dawn  4

data c
-------
name   age
Dawn   30
Bob     35
Jill        40
Jason    45
deb       50


Pick the answer-
a) 2
b) 3
c) 5
d) 10

Check the comments below for answers....


Technology Top Blogs On our way to 1,000,000 rss feeds - millionrss.com Hihera.com Blog Directory - OnToplist.com blogarama - the blog directory Blog Directory
Disclaimer

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Other brand and product names are trademarks of their respective companies.

This blog is not responsible for any kind of copyright violation. This blog just collects the links hosted or posted by other servers/people/search engines.The creator of this page or the ISP(s) hosting any content on this site take no responsibility for the way you use the information provided on this site.If anybody has any copyright claim on it and doesn’t wish the information provided to be shown on our site, please do respond to this email. We shall remove them off immediately. Any inconvenience is regretted. Please do mention your exact grievance/problems with respect to certain third party links. We assure you that appropriate action will be taken off. Thank you