Premium

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



Question : What happens when you run the following program?
proc sort data=work.newcourses;
run;

proc print data=work.newcourses;
var ID COURSENAME FEE;
where Fee=5000;
run;

 : What happens when you run the following program?
1. PROC PRINT Step will run and print the result in sorted order.

2. PROC SORT Step will permanently sort the given data

3. Access Mostly Uused Products by 50000+ Subscribers

4. PROC Sort step will run successfully, PROC PRINT step generates the error.


Correct Answer : Get Lastest Questions and Answer :
Explanation: As you can see whenever you need to sort the data you have to provide on which variable you want to sort. As given in the
question sort step does not have any BY statement, which causes SORT step to get failed. However, dataset exist hence print step will be successful and
produce the result. See below the correct syntax.
proc sort data=hadoopexam.courses;
by price;
run;
proc print data=hadoopexam.courses;
run;





Question : You will be running below program
proc sort data=hetrain.helr1 out=work.helr2;
by FEE ID ;
run;

proc print data=work.helr2 noobs;
var ID DATE LOCATION FEE ;
sum FEE DATE;
format FEE DOLLAR9.;
label DATE='Start On' LOCATION='Training Venue';
run;



What is the output will be generated


 : You will be running below program
1.
image1

2.
image2
3. Access Mostly Uused Products by 50000+ Subscribers
image3

4.
image4


Correct Answer : Get Lastest Questions and Answer :
Explanation: You should check Syntax as well as each statement used in the program. Code Syntax is correct, now you can see there is a sum
on two columns DATE and FEE, Hence , option 3 is out. They have used label statement hence option 4 is out. Fee has a DOLLAR format, it means some would
also have the same format, so option 2 is out. And option A is correct as per given program.




Question : You have to write a program such that following conditions are met
1. Course fee is less than or equal to $4000
2. The course id is 1 or course name is ٓpark

 : You have to write a program such that following conditions are met
1. where fee <= 4000 and
id=1 or name='Spark';


2. where (fee le 4000 and id=1)
or name='Spark';


3. Access Mostly Uused Products by 50000+ Subscribers
and (id=1 or name eq 'Spark');



4. where fee <= 4000 or id=1
and name='Spark';


Correct Answer : Get Lastest Questions and Answer :
Explanation: As given requirement you can build your own expression and compare it with the given option.
Fee<=4000 or you can write Fee le 4000 as well.
Now the important thing is in 2nd requirement they want multiple conditions to be satisfied. Hence, they should be written in parenthesis to be
correctly evaluated. Which you can write as below
(id =1 or name = ٓpark)
Now both the conditions should be satisfied. Hence, we need to use AND operator in between both the conditions.
Fee<=4000 AND (id =1 or name = ٓpark)
Equivalent option for this is Option 3 . Hence, option 3 is correct.



Related Questions


Question : You have been given below date, which input format you will use to read date values correctly?

 : You have been given below date, which input format you will use to read date values correctly?
1. mmddyy8.

2. Mmddyyyy8.

3. Access Mostly Uused Products by 50000+ Subscribers

4. DATETIME20.



Question : You are going to read following time values
12:12:12.12
And you can use format timew. Than what is the minimum possible width you can define?

 : You are going to read following time values
1. 2

2. 3

3. Access Mostly Uused Products by 50000+ Subscribers

4. 5

5. 11



Question : Which of the following date values and its format are correct?
A. 22May2017:10:03:17.2 DATETIME20.
B. 22May2017:10:03:17.2 DATETIME16.
C. 22FEB2017 DATE9.
D. 22FEB2017 DDMMMYYYY9.

 : Which of the following date values and its format are correct?
1. A,B
2. B,C
3. Access Mostly Uused Products by 50000+ Subscribers
4. A,D
5. B,D


Question : You have set YEARCUTOFF= (which is default as well). Now you have date as -May-. How this date will be read by SAS?

 : You have set YEARCUTOFF= (which is default as well). Now you have date as -May-. How this date will be read by SAS?
1. 01-May-2025

2. 01-May-1925

3. Access Mostly Uused Products by 50000+ Subscribers

4. 01-May-2026

5. 01-May-1926



Question : Which action assigns a reference named SALES to a permanent SAS data library?
  : Which action assigns a reference named SALES to a permanent SAS data library?
1. Issuing the command:
libref SALES 'SAS-data-library'
2. Issuing the command:
libname SALES 'SAS-data-library'
3. Access Mostly Uused Products by 50000+ Subscribers
libref SALES 'SAS-data-library';
4. Submitting the statement:
libname SALES 'SAS-data-library';
Ans : 4
Exp : The LIBNAME statement assigns a reference known as a libref to a permanent SAS data
library. The LIBNAME command opens the LIBNAME window.




Question : The following SAS program is submitted:

data newstaff;
set staff;
(insert WHERE statement here)
run;

Which one of the following WHERE statements completes the program and selects only observations with a Hire_date of February 23,2000?


  : Which action assigns a reference named SALES to a permanent SAS data library?
1. where hire_date='23feb2000'd;
2. where hire_date='23feb2000';
3. Access Mostly Uused Products by 50000+ Subscribers
4. where hire_date='02/23/2000';

Ans : 1
Exp : A SAS date constant must take the form of one- or two-digit day, three-digit month, and two- or four-digit year, enclosed in quotation marks and followed by a d
('ddmmmyy(yy)'d).



Question : Which one of the following SAS date formats displays the SAS date value for January , in the form of //?
  : Which action assigns a reference named SALES to a permanent SAS data library?
1. DATE10
2. DDMMYY10
3. Access Mostly Uused Products by 50000+ Subscribers
4. DDMMYYYY10


Ans : 2
Exp : The requested output is in day-month-year order and is 10 bytes long, so DDMMYY10. is the correct format. Although WEEKDATE10. is a valid SAS format, it does not display the
SAS date value as shown in the question above. DDMMYYYY10. is not a valid SAS date format, and the DATEw. format cannot accept a length of 10.

Detailed answer:
Date refers to this format inside Jan [date format date format only 7,9,11]
30May00 DATE7.
30May2000 DATE9.
30-May-2000 DATE11.

101599 MMDDYY6.
10/15/99 MMDDYY8.
10 15 99 MMDDYY8.
10-15-1999 MMDDYY10.

format datein weekdate3.; Mon
format datein weekdate6.; Monday
format datein weekdate17.; Monday, Apr 5, 99
format datein weekdate21.; Monday, April 5, 1999




Question : Which one of the following displays the contents of an external file from within a SAS session?
  : Which action assigns a reference named SALES to a permanent SAS data library?
1. the LIST procedure
2. the PRINT procedure
3. Access Mostly Uused Products by 50000+ Subscribers
4. the VIEWTABLE procedure
Ans : 3
Exp : The PRINT procedure and VIEWTABLE window display the values in SAS data sets. The FSLIST procedure displays the values in external files. There is no LIST procedure in SAS.



Question : The SAS data set Sashelp.Prdsale contains the variables Region and Salary with observations per Region.
Sashelp.Prdsale is sorted primarily by Region and with Region by Salary in descending order.
The following program is submitted:
data one;
set sashelp.prdsale;
retain temp;
by region descending salary;
if first.region then
do;
temp=salary;
output;
end;
if last.region then
do;
range=salary-temp;
output;
end;
run;
For each region, what is the number of observations(s) written to the output data set?

  : Which action assigns a reference named SALES to a permanent SAS data library?
1. 0
2. 1
3. Access Mostly Uused Products by 50000+ Subscribers
4. 4

Ans : 3
Exp : The expression first.region is true once for each region group. The expression last.region is true once for each region group. Therefore, each OUTPUT statement executes once
for a total of 2 observations in the output data set.






Question : The following program is submitted:

proc contents data=sasuser.houses;
run;

The exhibit below contains partial output produced by the CONTENTS procedure

Which of the following describes the Sasuser.Hourses data set?
  : Which action assigns a reference named SALES to a permanent SAS data library?
1. The data set is sorted but not indexed.
2. The data set is both sorted and indexed.
3. Access Mostly Uused Products by 50000+ Subscribers
4. The data set is neither sorted nor indexed.



Question The following SAS program is submitted:
proc sort data=work.test;
by fname descending salary;
run;
Which one of the following represents how the observations are sorted?

  The following SAS program is submitted:
1. The data set Work.Test is sorted in ascending order by both Fname and Salary values.
2. The data set Work.Test is sorted in descending order by both Fname and Salary values.
3. Access Mostly Uused Products by 50000+ Subscribers
4. The data set Work.Test is sorted in ascending order by Fname and descending order by Salary values.



Correct Ans : 4
Exp : The DESCENDING keyword is placed before the variable name it modifies in the BY statement, so the correct description is in descending order by Salary value within ascending
Fname values.





Question

The following SAS program is submitted:
data names;
title='EDU';
if title='EDU' then
Division='Education';
else if title='HR' then
Division='Human Resources';
else Division='Unknown';
run;
Which one of the following represents the value of the variable Division in the output data set?


  The following SAS program is submitted:
1. Educatio
2. Education
3. Access Mostly Uused Products by 50000+ Subscribers
4. Human Resources

Ans : 2
Exp : The length of the variable Division is set to 9 when the DATA step compiles. Since the value of the variable Title is EDU, the first IF condition is true; therefore, the value
of the variable Division is Education.





Question Which one of the following SAS programs creates a variable named City with a value of Chicago?
  The following SAS program is submitted:
1. data work.airports;
AirportCode='ord';
if AirportCode='ORD' City='Chicago';
run;

2. data work.airports;
AirportCode='ORD';
if AirportCode='ORD' City='Chicago';
run;

3. Access Mostly Uused Products by 50000+ Subscribers
AirportCode='ORD';
if AirportCode='ORD' then City='Chicago';
run;

4. data work.airports;
AirportCode='ORD';
if AirportCode='ORD';
then City='Chicago';
run;

Ans : 3
Exp : The correct syntax for an IF-THEN statement is: IF expression THEN statement;
In this example, the variable City is assigned a value of Chicago only if the expression AirportCode='ORD' is true.






Question : The following SAS program is submitted:
data work.building;
code='DAL523';
code='SANFRAN604';
code='HOUS731';
run;
Which one of the following is the length of the code variable?


  The following SAS program is submitted:
1. 6
2. 7
3. Access Mostly Uused Products by 50000+ Subscribers
4. 20
Ans : 1
Exp : The DATA step first goes through a compilation phase, then an execution phase. The length of a variable is set during the compilation phase and is based on the first time the
variable is encountered. In this case, the variable code is set to the length of the text string DAL523 which is 6 characters long. The next assignment statements are ignored during
compilation. The LENGTH statement is also ignored since the length has already been established, but a note will be written to the log.



Question Which of the following statements creates a numeric variable named IDnumber with a
value of 4198?
  The following SAS program is submitted:
1. IDnumber=4198;
2. IDnumber='4198';
3. Access Mostly Uused Products by 50000+ Subscribers
4. length IDnumber $ 8;
Ans :1
Exp : The first reference to the SAS variable in the DATA step sets the name, type, and length of the variable in the program data vector (PDV) and in the output SAS data set. The
assignment statement IDnumber=4198; is the first reference and creates a numeric variable named IDnumber with a default storage length of 8 bytes.



Question The following SAS program is submitted:

data fltaten;
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?
  The following SAS program is submitted:
1. Under 6
2. Under 60
3. Access Mostly Uused Products by 50000+ Subscribers
4. " (missing character value)
Ans :1
Exp : The variable description is being created by the IF-THEN/ELSE statement during compilation. The first occurrence of the variable description is on the IF statement, and since
it is assigned the value Over 60, the length of the variable is 7. Therefore, for the salary value of 30000, description has the value of Under 6 (the 0 is truncated.)

if salary>60000 then description='Over 60';

First appeared when the seven characters, so the length of the description is 7, so after becoming the eight-byte characters, the last one still can not tolerate



Question raw data file is listed below.

1---+----10---+----20---+---
23
15
The following program is submitted:

data all_sales;
infile 'file-specification';
input receipts;
(insert statement(s) here)
run;
Which statement(s) complete(s) the program and produce(s) a running total of the Receipts variable?

  The following SAS program is submitted:
1. total+receipts;
2. total 0;
sum total;
3. Access Mostly Uused Products by 50000+ Subscribers
4. total=sum(total,receipts);
Ans :1
Exp : The SUM function and the assignment statement do not retain values across iterations of the DATA step. The sum statement total+receipts; initializes total to 0, ignores missing
values of receipt, retains the value of total from one iteration to the next, and adds the value of receipts to total.


Question A raw data file is listed below.

1---+----10---+----20---+---
1901 2
1905 1
1910 6
1925 1
1941 1

The following SAS program is submitted and references the raw data file above:

data money;
infile 'file-specification';
input year quantity;
total=total+quantity;
run;

What is the value of total when the data step finishes executing

  The following SAS program is submitted:
1. 0
2. 1
3. Access Mostly Uused Products by 50000+ Subscribers
4. . (missing numeric value)
Ans :4
Exp : The variable Total is assigned a missing value during the compilation phase of the DATA step. When the first record is read in, SAS processes: total=.+2; which results in a
missing value. Therefore the variable Total remains missing for all observations.

total=total+quantity;

Because the right-hand side of the total did not define the very beginning, so here is total =. +2
After the state has also been missing



Question The following program is submitted:

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

What is the value of average?

  The following SAS program is submitted:
1. 0
2. 3
3. Access Mostly Uused Products by 50000+ Subscribers
4. . (missing numeric value)
Ans :3
Exp :The MEAN function adds all of the non-missing values and divides by the number of non-missing values. In this case, 6 + 4 + 2 divided by 3 is 4.
You can learn about the MEAN function in Transforming Data with SAS Functions.

All non-missing divided by the sum of the number of non-missing (equivalent to completely ignore missing)



Question The following SAS program is submitted:

data work.AreaCodes; Phonenumber=3125551212; Code='('!!substr(Phonenumber,1,3)!!')';run;

Which one of the following is the value of the variable Code in the output data set?

  The following SAS program is submitted:
1. ( 3)
2. (312)
3. Access Mostly Uused Products by 50000+ Subscribers
4. 312
Ans :1
Exp : An automatic data conversion is performed whenever a numeric variable is used where SAS expects a character value. The numeric variable is written with the BEST12. format and
the resulting character value is right-aligned when the conversion occurs. In this example, the value of Phonenumber is converted to character and right-aligned before the SUBSTR
function is performed. Since there are only 10 digits in the value of Phonenumber, the right-aligned value begins with two blanks. Therefore the SUBSTR function picks up two blanks
and a 3, and uses the BEST12. format to assign that value to Code. Then, the parentheses are concatenated before and after the two blanks and a 3.

In short, the numbers are right sort of
-
Specifically, SAS writes the numeric value with the BEST12. format, and the resulting character value is right-aligned. This conversion occurs before the value is assigned or used
with any operator or function. Automatic numeric-to-character conversion can cause unexpected results. For example, suppose the original numeric value has fewer than 12 digits. The
resulting character value will have leading blanks, which might cause problems when you perform an operation or function.
-
format
refers to the instructions that SAS uses when printing variable values. If no format is specified, the default format is BEST12. for a numeric variable, and $w. for a character
variable. You can assign SAS formats to a variable in the FORMAT or ATTRIB statement. You can use the FORMAT procedure to create your own format for a variable.



Question The following SAS program is submitted:

data work.inventory;
products=7;
do until (products gt 6);
products+1;
end;
run;

Which one of the following is the value of the variable products in the output data set?

  The following SAS program is submitted:
1. 5
2. 6
3. Access Mostly Uused Products by 50000+ Subscribers
4. 8
Ans :4
Exp : A DO UNTIL loop always executes at least once because the condition is not evaluated until the bottom of the loop. In the SAS program above, the value of Products is
incremented from 7 to 8 on the first iteration of the DO UNTIL loop, before the condition is checked. Therefore the value of Products is 8.


Question : The following program is submitted:
data work.test;
set work.staff (keep=salary1 salary2 salary3);
(insert ARRAY statement here)
run;
Which ARRAY statement completes the program and creates new variables?

  The following SAS program is submitted:
1. array salary{3};
2. array new_salary{3};
3. Access Mostly Uused Products by 50000+ Subscribers
4. array new_salary{3} salary1-salary3;
Ans :2