Thursday, October 4, 2012

Sas Interview Questions 8

Which program does not contain an error?
a.                proc report data=sasuser.houses nowd;
b.                    column style bedrooms baths;
c.                    define style / order;
d.                    define bedbathratio / computed format=4.2;
e.                    compute bedbathratio;
f.                         bedbathratio=baths.sum/bedrooms.sum;
g.                    endcomp;

h.                run;
i.                  proc report data=sasuser.houses nowd;
j.                      column style bedrooms baths BedBathRatio;
k.                    define style / order;
l.                      define bedbathratio / order format=4.2;
m.                  compute bedbathratio;
n.                       bedbathratio=baths.sum/bedrooms.sum;
o.                    endcomp;
p.                run;
q.                proc report data=sasuser.houses nowd;
r.                     column style bedrooms baths BedBathRatio;
s.                     define style / order;
t.                      define bedbathratio / computed format=4.2;
u.                    compute bedbathratio;
v.                       bedbathratio=baths.sum/bedrooms.sum;
w.                  endcomp;
x.                run;
y.                proc report data=sasuser.houses nowd;
z.                    column style bedrooms baths BedBathRatio;
aa.                define style / order;
bb.                define bedbathratio / computed format=4.2;
cc.                 compute bedbathratio;
dd.                   bedbathratio=baths/bedrooms;
ee.                endcomp;
ff.                run;
What output does this PROC REPORT step produce?
proc report data=sasuser.houses nowd;
   column style sqfeet bedrooms price;
run;
a.         a list report ordered by values of the first variable in the COLUMN statement
b.         a summary report ordered by values of the first variable in the COLUMN statement
c.          a list report that displays a row for each observation in the input data set and which calculates the SUM statistic for numeric variables
d.         a list report that calculates the N (frequency) statistic for character variables
Which of the following programs produces this output?
Style

CONDO
RANCH
SPLIT
TWOSTORY
Average Price
4
4
3
4
$82,720
a.                proc report data=sasuser.houses nowd;
b.                    column style condo range split
c.                           twostory price;
d.                 
e.                    define price / mean 'Average Price';
f.                  run;
g.                proc report data=sasuser.houses nowd;
h.                    column style price;
i.                      define style / group;
j.                      define price / mean 'Average Price';
k.                run;
l.                  proc report data=sasuser.houses nowd;
m.                  column style price;
n.                    define style / across;
o.                    define price / mean 'Average Price';
p.                run;
q.                proc report data=sasuser.houses nowd;
r.                     column style price;
s.                     define style / across 'CONDO' 'RANCH'
t.                            'SPLIT' 'TWOSTORY';
u.                    define price / mean 'Average Price';
v.                run;
If you submit this program, where does your PROC REPORT output appear?
proc report data=sasuser.houses nowd;
   column style sqfeet bedrooms price;
   define style / group;
run;
a.         in the PROC REPORT window
b.         as HTML and/or SAS listing output
c.          both of the above
d.         neither of the above
How can you create output with headings that break as shown below?
style of    Average       Maximum
 House     Bedrooms         Baths
 CONDO         2.75           2.5
 RANCH         2.25             3
 SPLIT     2.666666             3
TWOSTORY          3             3
a.         You must specify the SPLIT= option in the PROC REPORT statement and use the split character in column headings in DEFINE statements.
b.         You must use the default split character in column headings in DEFINE statements.
c.          You must specify either the WIDTH= or the SPACING= attribute in DEFINE statements.
d.         These headings split this way by default.
Suppose you want to create a report using both character and numeric variables. If you don't use any DEFINE statements in your PROC REPORT step,
a.         your PROC REPORT step will not execute successfully.
b.         you can produce only list reports.
c.          you can order rows by specifying options in the PROC REPORT statement.
d.         you can produce only summary reports.
The default statistics produced by the MEANS procedure are n-count, mean, minimum, maximum, and
a.         median.
b.         range.
c.          standard deviation.
d.         standard error of the mean.
Which statement will limit a PROC MEANS analysis to the variables Boarded, Transfer, and Deplane?
a.         by boarded transfer deplane;
b.         class boarded transfer deplane;
c.          output boarded transfer deplane;
d.         var boarded transfer deplane;
The data set Survey.Health includes the following variables. Which is a poor candidate for PROC MEANS analysis?
a.         IDnum
b.         Age
c.          Height
d.         Weight
Which of the following statements is true regarding BY-group processing?
a.         BY variables must be either indexed or sorted.
b.         Summary statistics are computed for BY variables.
c.          BY-group processing is preferred when you are categorizing data that contains few variables.
d.         BY-group processing overwrites your data set with the newly grouped observations.
Which group processing statement produced the PROC MEANS output shown below?
Survive
Sex
N Obs
Variable
N
Mean
Std Dev
Minimum
Maximum
DIED
1
4
Arterial
4
92.5
10.5
83.0
103.0
Heart
4
111.0
53.4
54.0
183.0
Cardiac
4
176.8
75.2
95.0
260.0
Urinary
4
98.0
186.1
0.0
377.0

2
6
Arterial
6
94.2
27.3
72.0
145.0
Heart
6
103.7
16.7
81.0
130.0
Cardiac
6
318.3
102.6
156.0
424.0
Urinary
6
100.3
155.7
0.0
405.0
SURV
1
5
Arterial
5
77.2
12.2
61.0
88.0
Heart
5
109.0
32.0
77.0
149.0
Cardiac
5
298.0
139.8
66.0
410.0
Urinary
5
100.8
60.2
44.0
200.0

2
5
Arterial
5
78.8
6.8
72.0
87.0
Heart
5
100.0
13.4
84.0
111.0
Cardiac
5
330.2
87.0
256.0
471.0
Urinary
5
111.2
152.4
12.0
377.0
a.         class sex survive;
b.         class survive sex;
c.          by sex survive;
d.         by survive sex;
Which program can be used to create the following output?
Sex
N Obs
Variable
N
Mean
Std Dev
Minimum
Maximum
F
11
Age
11
48.9090909
13.3075508
16.0000000
63.0000000
Height
11
63.9090909
2.1191765
61.0000000
68.0000000
Weight
11
150.4545455
18.4464828
102.0000000
168.0000000
M
9
Age
9
44.0000000
12.3895117
15.0000000
54.0000000
Height
9
70.6666667
2.6457513
66.0000000
75.0000000
Weight
9
204.2222222
30.2893454
140.0000000
240.0000000
a.                proc means data=clinic.diabetes;
b.                     var age height weight;
c.                     class sex;
d.                     output out=work.sum_gender
e.                       mean=AvgAge AvgHeight AvgWeight;
f.                  run;
g.                proc summary data=clinic.diabetes print;
h.                    var age height weight;
i.                      class sex;
j.                      output out=work.sum_gender
k.                      mean=AvgAge AvgHeight AvgWeight;
run;
l.                  proc means data=clinic.diabetes noprint;
m.                  var age height weight;
n.                     class sex;
o.                     output out=work.sum_gender
p.                       mean=AvgAge AvgHeight AvgWeight;
q.                run;
r.           Both a and b.
By default, PROC FREQ creates a table of frequencies and percentages for which data set variables?
a.         character variables
b.         numeric variables
c.          both character and numeric variables
d.         none: variables must always be specified
Frequency distributions work best with variables that contain
a.         continuous values.
b.         numeric values.
c.          categorical values.
d.         unique values.
Which PROC FREQ step produced this two-way table?
Image from book
a.                proc freq data=clinic.diabetes;
b.                     tables height weight;
c.                     format height htfmt. weight wtfmt.;r
d.                un;
e.                proc freq data=clinic.diabetes;
f.                       tables weight height;
g.                     format weight wtfmt. height htfmt.;
h.                run;
i.                  proc freq data=clinic.diabetes;
j.                       tables height*weight;
k.                     format height htfmt. weight wtfmt.;
l.                  run;
m.              proc freq data=clinic.diabetes;
n.                     tables weight*height;
o.                     format weight wtfmt. height htfmt.;
p.                run;
Which PROC FREQ step produced this table?
Image from book
a.                proc freq data=clinic.diabetes;
b.                      tables sex weight / list;
c.                      format weight wtfmt.; 
d.                run;
e.                proc freq data=clinic.diabetes;
f.                        tables sex*weight / nocol;
g.                      format weight wtfmt.; 
h.                run;
i.                  proc freq data=clinic.diabetes;
j.                        tables sex weight / norow nocol;
k.                      format weight wtfmt.; 
l.                  run;
m.              proc freq data=clinic.diabetes;
n.                      tables sex*weight / nofreq norow nocol;
o.                     format weight wtfmt.; 
p.                run;
Using ODS statements, how many types of output can you generate concurrently?
a.         1 (only listing output)
b.         2
c.          3
d.         as many as you want
If ODS is set to its default settings, what types of output are created by the code below?
ods html file='c:\myhtml.htm';
ods pdf file='c:\mypdf.pdf';
a.         HTML and PDF
b.         PDF only
c.          HTML, PDF, and listing
d.         No output is created because ODS is closed by default.
What is the purpose of closing the Listing destination in the code shown below?
ods listing close;
ods html ... ;
a. It conserves system resources.
b. It simplifies your program.
c. It makes your program compatible with other hardware platforms.
d. It makes your program compatible with previous versions of SAS software.
When the code shown below is run, what will the file D:\Output\body.html contain?
ods html body='d:\output\body.html';
proc print data=work.alpha;
run;
proc print data=work.beta;
run;
ods html close;
a.         The PROC PRINT output for Work.Alpha.
b.         The PROC PRINT output for Work.Beta.
c.          The PROC PRINT output for both Work.Alpha and Work.Beta.
d.         Nothing. No output will be written to D:\Output\body.html.
When the code shown below is run, what file will be loaded by the links in D:\Output\contents.html?
ods html body='d:\output\body.html'
         contents='d:\output\contents.html'
         frame='d:\output\frame.html';
a.         D:\Output\body.html
b.         D:\Output\contents.html
c.          D:\Output\frame.html
d.         There are no links from the file D:\Output\contents.html.
The table of contents created by the CONTENTS= option contains a numbered heading for
a.         each procedure.
b.         each procedure that creates output.
c.          each procedure and DATA step.
d.         each HTML file created by your program.
When the code shown below is run, what will the file D:\Output\frame.html display?
ods html body='d:\output\body.html'
         contents='d:\output\contents.html'
         frame='d:\output\frame.html';
a.         The file D:\Output\contents.html.
b.         The file D:\Output\frame.html.
c.          The files D:\Output\contents.html and D:\Output\body.html.
d.         It displays no other files.
What is the purpose of the URL= suboptions shown below?
ods html body='d:\output\body.html' (url='body.html')
         contents='d:\output\contents.html' (url='contents.html')
         frame='d:\output\frame.html';
a.         To create absolute link addresses for loading the files from a server.
b.         To create relative link addresses for loading the files from a server.
c.          To allow HTML files to be loaded from a local drive.
d.         To send HTML output to two locations.
Which ODS HTML option was used in creating the following table?
Image from book
a.         format=brown
b.         format='brown'
c.          style=brown
d.         style='brown'
What is the purpose of the PATH= option?
ods html path='d:\output' (url=none)
         body='body.html'
         contents='contents.html'
         frame='frame.html';
a.         It creates absolute link addresses for loading HTML files from a server.
b.         It creates relative link addresses for loading HTML files from a server.
c.          It allows HTML files to be loaded from a local drive.
d.         It specifies the location of HTML file output.
Which program creates the output shown below?
Image from book
StockNum
Finish
Style
Item
TotalPrice
310
oak
pedestal
table
329.99
311
maple
pedestal
table
699.98
312
brass
floor
lamp
779.97
313
glass
table
lamp
839.96
a.                data test2;
b.                    infile furnture;
c.                    input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18
d.                        Item $ 20-24 Price 26-31;
e.                    if finish='oak' then delete;
f.                      retain TotPrice 100;
g.                    totalprice+price;
h.                    drop price;
i.                  run;
j.                  proc print data=test2 noobs;
k.                run;
l.                  data test2;
m.                  infile furnture;
n.                    input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18
o.                        Item $ 20-24 Price 26-31;
p.                    if finish='oak' and price<200 delete="delete" span="span" then="then">
q.                    TotalPrice+price;
r.                 run;
s.                 proc print data=test2 noobs;
t.                  run;
u.                data test2(drop=price);
v.                    infile furnture;
w.                  input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18
x.                        Item $ 20-24 Price 26-31;
y.                    if finish='oak' and price<200 delete="delete" span="span" then="then">
z.                    TotalPrice+price;
aa.            run;
bb.            proc print data=test2 noobs;
cc.             run;
dd.            data test2;
ee.                infile furnture;
ff.                    input StockNum $ 1-3 Finish $ 5-9 Style $ 11-18
gg.                    Item $ 20-24 Price 26-31;
hh.                if finish=oak and price<200 delete="delete" price="price" span="span" then="then">
ii.                    TotalPrice+price;
jj.                run;
kk.             proc print data=test2 noobs;
ll.                run;

No comments: