Docsity

Midterm Exam Solutions - SAS Base Programming | PSTAT 130, Exams of Statistics

Toggle sidebar
bg1
1.
Which two elements does a SAS program have?
a) Variables and hctions
b) Data and instructions
o
c) Data step and procedure step
d) Data step and variables
e) Data step and Proc Print
data seasons;
SET temps;
IF
Temperature
>
100
THEN Status
=
'Hot';
ELSE
Status
=
'Cold'
;
Given the above code and a Temperature value of
67,
what would the value of Status be:
a) Hot
b) Cold
c)
99
Cd) Col
e)
67
3
Which of the following is a valid SAS name?
a) Sdatamon
b) data#5
'0
monthssdata
d) five months data
4
Given that the data set named
ONE
contains 10 observations and the data set named
TWO
contains 10
observations, how many observations will be contained in the data set named
COMBINE
that is created
in
the following DATA step?
data combine;
set one two;
run;
0
20
c) 0, the DATA step will fail due to syntax errors.
d) 10 to 20, depending on how
many
observations match.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
Discount

On special offer

Partial preview of the text

Download Midterm Exam Solutions - SAS Base Programming | PSTAT 130 and more Exams Statistics in PDF only on Docsity!

Which two elements does a SAS program have?

a) Variables and h c t i o n s b) Data and instructions o c) Data step and procedure step d) Data step and variables e) Data step and^ Proc^ Print

data seasons; SET temps; IF Temperature > 100 THEN Status = 'Hot'; ELSE Status = 'Cold' ;

Given the above code and a Temperature value of 67, what would the value of Status be:

a) Hot b) Cold c) 99 Cd) Col e) 67

Which of the following is a valid SAS name?

a) Sdatamon b) data#

' 0 monthssdata

d) five months data

Given that the data set named ONE contains 10 observations and the data set named TWO contains 10

observations, how many observations will be contained in the data set named COMBINE that is created in the following DATA step?

data combine; set one two; run;

0 20 c) 0, the DATA step will fail due to syntax errors. d) 10 to 20, depending on how^ many^ observations match.

Length Name $6;

INPUT Name $1 - 6;

Given the above merit of code, what value would Name have given the data 'Albert' as input:

c) d) None of the above e ) A

The following code is submitted:

data test; average=mean ( 6,4,. ,2 ) ; run;

What is the value of average?.

.(missing numeric value) el 5

Which X variable has a value of 1 at the end of an input file?

The following is an example of. ... (choose one)

data employee; infile 'employee.datl; input id $6. name $20. 1330 locale $10.; run;

Column only

d) Mixed e) Standard

f.glCXppunu : a l a p w q $ amu-lsry $ uo!lalaJ lndy (^) (P f-galap : alapqwq $ amuU1sry $ uo!lalai lndy I.gMppunu alapqnq $ amuUlsry $ uo!)alaJ lndy

ifs3>

!s

1-galapa)epytrIq $ amu-lsn~$ uoyajaJ indu! (^) (a \

jsanlv~alap svs a w p q n a aIqegah ayl JOJ sanplr ay) spaal Lp3a.1.103luawalvls J. ~ W g y m

! unx !, u o r ~ e 3 ~ ~ ~ 3 a d s - a ~ ~ j ,a T T j u T. ! A T T u ~ ~' y l O M eqep

.Molaq pals!~s! sly QV M ~ Jv

' E l

ilas svp )n&no aw q uo!s!A!a alqapA ayljo anlar\ ayl q u a s a ~ d a ~%u;r~o(lojayljo auo 9 3 1 ~.

~ ~ l l o w i programn g is submitted:

data fitaten; input jobcode' $ salary name $; cards; FLAT1 70000 Bob FLAT2 60000 Joe FLAT3 30090 Ann I run; data desc; set fltaten; if salary>60000 then description-'Over 60'; else description='Under 60'; run;

What is value of the variable named description when the value for salary is 300001

(&under 6 b) Under 60 c) Over 60 d) " (Missing character value) e). (Missing numeric value)

15. 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 PflUL files are created?

14. ,. I following program is submitted:

i.

data fitaten; input jobcode $ salary name $; cards; FLAT1 70000 Bob FLAT2 60000 Joe FLAT3 30000 Ann ; run; data desc; set fltaten; if salary>60000 then description='Over 60'; else description='Under 60'; run;

What is value of the variable named description when the value for salary is 30000?

Q ~ h 6 r b) Under 60 c) Over 60

d) ' ' (Missing character value)

e). (Missing numeric value)

15. The following SAS program is submitted:

ods html file='newfile.htmll; 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?

The following SAS program is submitted:

data work.building; code='DAL523'; code='SANFRAN604'; code='HOUS731'; length code $ 20; run;

Which one of the following is the length of the code variable?

  1. ' 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^ LINEN0^ option b) Decrease the value of the^ PAGENO^ option c) Decrease the value of the^ LMESIZE^ option. @I Increase the value of the PAGESIZE option.

18. Which of the following is NOT created at compile time?

a) the program data vector (PDV) b) the data set descriptor

(c'C, the first observation

d) the -N- automatic variable

Which is an example of standard numeric data?

Which of t4e following FORMAT procedures is written correctly? a) proc format lib=library value colorfmt; 1= \Redr 2= 'Green 3= \Bluer run;

  • 1 1 \ proc format lib=library; value colorfmt; 1- \Red 2= 'Greenr 3- \Bluet; run;

proc format lib=library; value colorfmt; 1= \Redr. 2= \Green 3= \Bluer run;

proc format lib=library; value colorfmt 1= \Red1; 2= \Greenr; 3= \Blue1; run;

24. What are the final titles resulting fiom the following program?

proc print data=work.march; title1 'The First Liner; title2 'The Second Line' ; run; proc print data=work.march; title \The Top Line1; run;

The First Line The Second Line

The Top Line

c) The Top Line The Second Line

The First Line The Top Line

Below is part of the SAS data set ia.empdata.

whi& skmttnt must be added to the following code in order to print only the EmpIDYsand Salaries of the Pilots?

proc print data=ia.empdata noobs; var JobCode EmpID Salary; ( i n s e r t statement here> run;

@, where Jobbode= VPILOT' ;

Which of the following SAS date formats displays the SAS date value for January 16 2002 in the form 1610 1/2002?

Which of the following procedures is NOT a report writing procedure?

a) PROCMEANS

b) PROCFREQ

d) PROC TABULATE

A raw data file, dfwlax. dat , is listed below

Destination 1 12- First Class 1 15-17 1

Description Flight number Date

I Economv 1 18-20 I

Column 1- 4-1 1

The following program is submitted using the above file as input:

data work.dfwlax; infile 'dfwlax.dat';

< i n s e r t i n p u t statement here>

run;

Which of the following MPUT statements reads the raw data file correctly?

a> input

c> input

dl input

Flight 1-3 Date 4-

. Dest 12-14 Firstclass 15- Economy 18-20;

Flight $ 1-3 Date $ 4- Dest $ 12-14 FirstClass 15- Economy 18-20;

Flight 1-3 Date 4- Dest $ 12-14 FirstClass 15- Economy 18-20;

Flight $ 1-3 Date $ 4- Dest 12-14 FirstClass 15- Economy 18-20;

title2 'by JobCode'; proc tabulate data=ia.fltat; class Location JobCode; <in s e r t statement here>

run;

What statement must be added to the above code to output the table given below?

The SAS System by JobCode

a) table JobCode Location;

b) table Location, JobCode;

c g t a b l e JobCode, Location;

i.

d) table Location JobCode;

END OF EXAMINATION

. .A '"I .'$

8. I.,s