Premium

Base SAS Certified Associate: Programming Fundamentals Using SAS Questions and Answers (Dumps and Practice Questions)



Question : A SAS PRINT procedure output of the WORK.LEVELS data set is listed below:
Obs name level
1 Frank 1
2 Joan 2
3 Sui 2
4 Jose 3
5 Burt 4
6 Kelly .
7 Juan 1
The following SAS program is submitted:
data work.expertise;
set work.levels;
if level = . then
expertise = 'Unknown';
else if level = 1 then
expertise = 'Low';
else if level = 2 or 3 then
expertise = 'Medium';
else
expertise = 'High';
run;
Which of the following values does the variable EXPERTISE contain?
 :  A SAS PRINT procedure output of the WORK.LEVELS data set is listed below:
1. Low, Medium, and High only
2. Low, Medium, and Unknown only
3. Low, Medium, High, and Unknown only
4. Low, Medium, High, Unknown, and ' ' (missing character value)

Correct Answer : 2

Explanation:
IF expression THEN statement;
ELSE statement;
Arguments

expression is any SAS expression and is a required argument.
statement can be any executable SAS statement or DO group.
SAS evaluates the expression in an IF-THEN statement to produce a result that is either non-zero, zero, or missing. A non-zero and nonmissing result causes the expression to be true;
a result of zero or missing causes the expression to be false.
If the conditions that are specified in the IF clause are met, the IF-THEN statement executes a SAS statement for observations that are read from a SAS data set, for records in an
external file, or for computed values. An optional ELSE statement gives an alternative action if the THEN clause is not executed. The ELSE statement, if used, must immediately follow
the IF-THEN statement. Using IF-THEN statements without the ELSE statement causes SAS to evaluate all IF-THEN statements. Using IF-THEN statements with the ELSE statement causes SAS
to execute IF-THEN statements until it encounters the first true statement. Subsequent IF-THEN statements are not evaluated. Note: For greater efficiency, construct your
IF-THEN/ELSE statement with conditions of decreasing probability.





Question : The contents of the raw data file EMPLOYEE are listed below:

--------10-------20-------30
Ruth 39 11
Jose 32 22
Sue 30 33
John 40 44
The following SAS program is submitted:
data test;
infile 'employee';
input employee_name $ 1-4;
if employee_name = 'Ruth' then input idnum 10-11;
else input age 7-8;
run;
Which one of the following values does the variable IDNUM contain when the name of the employee is "Ruth"?
 :  The contents of the raw data file EMPLOYEE are listed below:
1. 11
2. 22
3. 32
4. . (missing numeric value)

Correct Answer : 2

Exp: This is a free listing format and the cursor moves to the second record and picks up 22. if you run the program as it is the answer should be and is '2' but if you change the
position of idnum to 9-10, then the answer is 22.
As the pointer moves to next column when its checks the condition....
The output would be

employee_name idnum age
Ruth 22 .
Sue . 0(the zero value is of John age 40)





Question : The contents of the raw data file EMPLOYEE are listed below:

--------10-------20-------30
Ruth 39 11
Jose 32 22
Sue 30 33
John 40 44
The following SAS program is submitted:
data test;
infile 'employee';
input employee_name $ 1-4;
if employee_name = 'Sue' then input age 7-8;
else input idnum 10-11;
run;
Which one of the following values does the variable AGE contain when the name of the employee is "Sue"?


 :  The contents of the raw data file EMPLOYEE are listed below:
1. 30
2. 33
3. 40
4. . (missing numeric value)

Correct Answer : 4
Answer should be 4(missing); question talks about when the conditon is "sue" and not the program output
To get the correct result
data test;
infile employee;
input employee_name $ 1-4 @;
if employee_name = 'Sue' then input age 6-7;
else input idnum 8-10;
run;
proc print;
run;



Related Questions


Question : The following SAS program is submitted:
data work.passengers;
if OrigPassengers = then
OrigPassengers = 100;
TransPassengers = 100;
OrigPassengers =
TotalPassengers = sum (OrigPassengers, TransPassengers) +0;
run;
What is the value of the TOTALPASSENGERS variable in the output data set?
 : The following SAS program is submitted:
1. 0
2. 100
3. 200
4. (missing numeric value)


Question :
Given the SAS data set PRICES:
PRICES
Prodid priceproducttypesalesreturns
K1255.10NETWORK152
B132S 2.34HARDWARE30010
R18KY2 1.29SOFTWARE255
3KL8BY 6.37HARDWARE12515
DY65DW 5.60HARDWARE455
DGTY23 4.55HARDWARE672
The following SAS program is submitted:
data hware inter cheap;
set prices(keep = productype price);
if producttype = `HARDWARE' then output hware; else if producttype = `NETWORK' then output
inter; if price le 5.00;
run;
if producttype = `HARDWARE' then output hware; else if producttype = `NETWORK' then output
inter; if price le 5.00;
run;
How many observations does the HWARE data set contain?

 :
1. 0
2. 2
3. 3
4. 4


Question : The following SAS program is submitted:
How many observations are written to the WORK.SALES data set?
 : The following SAS program is submitted:
1. 0
2. 1
3. 5
4. 60


Question : The following SAS program is submitted:
The program fails execution due to syntax errors. What is the cause of the syntax error?
 : The following SAS program is submitted:
1. The variable MONTHSALES does not exist.
2. An array cannot be referenced on a KEEP data set option.
3. The KEEP= data set option should be (KEEP = MONTHSALES).
4. The KEEP= data set option should be the statement KEEP MONTHSALES{12}.


Question : Given the SAS data set EMPLOYEES:
EMPLOYEES
NAME SALARY
-------- ------------
Innis 60000
Jolli 50000
Ellis 55000
Liu 45000
The following SAS program is submitted:
proc print data = employees; where name like '_i%'; run; What is contained in the output?
 : Given the SAS data set EMPLOYEES:
1. Liu only
2. Innis and Ellis only
3. Innis, Ellis, and Liu only
4. Innis, Jolli, Ellis, and Liu


Question : Given the SAS data set ONE:
ONE
ObsDte
-------------
109JAN2005
212JAN2005
The following SAS program is submitted:
data two;
set one;
day = (insert expression here);
format dte date9.;
run;
The data set TWO is created:
TWO
ObsDteDay
109JAN20051
12JAN20054
Which expression successfully completed the program and created the variable DAY?
 : Given the SAS data set ONE:
1. day(dte)
2. weekday(dte)
3. dayofweek(dte)
4. datdif(dte,'01jan2005'd,'act/act')