SAS Base Certification Questions and Answers - Part 1 of 4

Deepanshu Bhalla 28 Comments ,
The following is a list of questions that can help you to crack Base SAS certification exam.

Base SAS Certification Preparation Guide

Q1.
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 named WORK.SALARY contains 10 observations for each department, currently ordered by DEPARTMENT.

Which one of the following is true regarding the program above?
A. The BY statement in the DATA step causes a syntax error.
B. FIRST.DEPARTMENT & LAST.DEPARTMENT are variables in WORK.TOTAL dataset.
C. The values of the variable PAYROLL represent the total for each department in the WORK.SALARY data set.
D. The values of the variable PAYROLL represent a total for all values of WAGERATE in the WORK.SALARY data set.

Answer: C. For every BY group we get the sum of wagerate in the Payroll variable for each department.



Q2. The following SAS program is submitted:

data test;
set sasuser.employees;
if 2 le years_service le 10 then
amount = 1000;
else if years_service gt 10 then
amount = 2000;
else
amount = 0;
amount_per_year = years_service / amount;
run;

Which one of the following values does the variable AMOUNT_PER_YEAR contain if an employee has been with the company for one year?
A. 0
B. 1000
C. 2000
D. . (missing numeric value)

Answer : D (missing). It returns missing value as amount will be 0.
SAS Log: NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to missing values.



Q3. The contents of the raw data file NAMENUM are listed below:
--------10-------20-------30
Joe xx

The following SAS program is submitted:
data test;
infile 'namenum';
input name $ number;
run;

Which one of the following is the value of the NUMBER variable?
A. xx
B. Joe
C. . (missing numeric value)
D. The value can not be determined as the program fails to execute due to errors.

Answer : C. It is because number is defined as a numeric variable so it is expecting a numeric value but it reads xx, so number will be a missing value.


Q4. How many of the following variable names will not produce errors in an assignment statement?

variable
var
1variable
var1
#var
_variable#

A. 0
B. 1
C. 3
D. 6

Answer : C ; variable var var1. A variable cannot start with numeric or special characters except _. You also cannot use special characters anywhere in the name either though numeric values are allowed.



Q5. Suppose the variable 'Unit_Cost_Price' (numeric) contains both missing and non missing values. What would the following code return?

proc sort data=ecsql1.price_list;
 by Unit_Cost_Price;
run;

A. A new dataset work.price_list is created with Unit_Cost_Price sorted in ascending order with missing values at the bottom of the dataset
B. The dataset ecsql1.price_list is sorted with Unit_Cost_Price sorted in descending order with missing values at the bottom of the dataset
C. A new dataset work.price_list is created with Unit_Cost_Price sorted in descending order with missing values at the top of the dataset
D. The dataset ecsql1.price_list is sorted with Unit_Cost_Price sorted in ascending order with missing values at the top of the dataset

Answer : D. It is because missing values are considered as lowest values (ascending order; they will be top of the data set)


Q6. The following SAS program is submitted:

   dta work.il_corn;
    set corn.state_data;
    if state = 'Illinois';
   run;
The keyword "data" is misspelled above. What happens to this program during the compilation phase assuming "corn" is a valid libref?

A. The program fails due to syntax errors
B. The DATA step compiles but doesn't execute
C. The DATA step compiles and executes 
D. None of the above

Answer : C. It compiles and executes as SAS assumed that the 'dta' was data. But it leaves a warning in log window.
The log shows the following warning :
WARNING 1-322: Assuming the symbol DATA was misspelled as dta.
141 run;



Q7. Which of the following is a valid statement about the VALUE range in the PROC FORMAT procedure? It cannot be...

A. A single character or numeric value
B. A range of character values
C. A list of unique values separated by commas
D. A combination of character and numeric values

Answer : D.



Q8. How many of the following statistics that PROC MEANS computes as default statistics?

Standard deviation
Range
Count
Minimum value
Variance
Mode

A. 2
B. 3
C. 4
D. None of the above

Answer : B. By default, PROC MEANS calculates count, mean, standard deviation, minimum and maximum value.



Q9. The following SAS program is submitted:

data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ;
do i=1 to 12;
monthsales{i} = sales;
end;
run;

The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.

Which one of the following is the result of the above program?
A. The program fails execution due to data errors.
B. The program fails execution due to syntax errors.
C. The program executes with warnings and creates the WORK.TOTALSALES data set.
D. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.

Answer : B. The syntax issue lies in this line of code - keep = msales{12}
To correct the syntax issue, replace keep = msales{12} with keep = msales1-msales12

See the errors in log window :

153 data work.totalsales(keep = msales{12} ) ;

ERROR 214-322: Variable name { is not valid.
ERROR 23-7: Invalid value for the KEEP option.



Q10. The following SAS program is submitted:

data work.accounting;
set work.dept1 work.dept2;
run;

A character variable named JOBCODE exists in both the WORK.DEPT1 and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in the WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set. 

Which one of the following is the length of the variable JOBCODE in the output data set?

A. 5     
B. 7     
C. 8     
D. 12 

Answer : Since SAS checks the variable Job_code in DEPT1 for the first time of length of 5 Bytes. it sets the length to be 5. All the values that are read from DEPT2 are truncated to Chars.

Next : Part 2 : SAS Base Certification Questions and Answers
Related Posts
Spread the Word!
Share
About Author:
Deepanshu Bhalla

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 10 years of experience in data science. During his tenure, he worked with global clients in various domains like Banking, Insurance, Private Equity, Telecom and HR.

Post Comment 28 Responses to "SAS Base Certification Questions and Answers - Part 1 of 4"
  1. This is a great reference guide for those who are preparing for certificaiton... There truly exists lack of such detailed reference for SAS. I am glad you guys are working to fill up the void. Great work guys ... cheers !!!

    ReplyDelete
  2. Thank you, it was very usefull

    ReplyDelete
  3. This is of great help... Thanks a ton and keep up the good work!!!

    ReplyDelete
  4. This is Amazingly explained
    There are also few concepts even after reading couldn't get cleared which got here
    Thank you so much :)
    Great work keep it up
    Kudos :)

    ReplyDelete
  5. This is Amazingly explained
    There are also few concepts even after reading couldn't get cleared which got here
    Thank you so much :)
    Great work keep it up
    Kudos :)

    ReplyDelete
  6. Great resource -- thank you. For Q4, the answer should include "1variable".

    ReplyDelete
    Replies
    1. Never mind. Misread the question. The supplied answer is correct. :) Thanks again.

      Delete
    2. Variables never start start with numbers

      Delete
  7. Is it true there are short answer questions? or just multiple choices?

    ReplyDelete
    Replies
    1. There are only multiple choice questions in the certification exam! Going for a second chance and hopefully the last one tomorrow! First time just one question kept me away from passing :( This time all over again preparation and going for it!

      Delete
    2. Thanks for responding. I am wondering because the SAS website mentioned about short answer questions. Do you find it similar to the practice questions above?

      Delete
  8. I just started my prep. was looking for some practice questions. Great place to start with. Kindly post more questions so that I can have more practice. Thanks mate.

    ReplyDelete
  9. This is very helpful and concept clearing questions.It will be very great if more number of questions will be available for reading.

    ReplyDelete
  10. Its regarding Q8. Just wondering if Proc Means gives COUNT as default. It rather gives the count of N and NMISS values as default.

    ReplyDelete
  11. great job and helping too. can you provide detail on the SAS certification.

    ReplyDelete
  12. Standard deviation
    Range
    Count
    Minimum value
    Variance
    Mode


    proc means calculate minimum value also

    ReplyDelete
  13. Hi Friends
    Plz share basis sas dumps questions for base sas certification

    ReplyDelete
  14. THANK U SO MUCH FOR SHARING THESE QUESTIONS WITH ANS and logic ,SO THAT WE CLEARED OUR BASIC KNOWLEDGE PERFECTLY..plz share more questions to clear my certification as soon as possible.i really need this..its very helpful fo rclear my doubts in base ss exam

    ReplyDelete
  15. Please share latest base SAS certification questions...it is very helpful for clear my base sas exam

    ReplyDelete
  16. Thank you , it is so useful, Please share latest SAS Certification question answers .

    ReplyDelete
Next → ← Prev