Premium

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



Question :

The following SAS program is submitted:
data work.company;
set work.dept1(keep = jobcode)
work.dept2(rename = (jcode = jobcode));
run;
Which one of the following is the result?

  :
1. The variable JCODE is written to the output data set.
2. The variable JOBCODE is written to the output data set.
3. Access Mostly Uused Products by 50000+ Subscribers
4. The program fails to execute due to errors.

Correct Answer : Get Lastest Questions and Answer :

Explanation: The variable jcode in the second dataset is renamed as JOBCODE and since there is no BY variable specified, the datasets are simply appended one on top without any overwriting.

The code above can be rewritten in a way that set and the two datasets are in the same line. So the set statement continues till the end of work.dept2(rename = (jcode = jobcode));

Since there is a semicolon that the end of the set statement, that is not an issue.

Renaming the dataset takes place during the set statement, therefore the name is current. So both datasets have jobcode variable.

"The RENAME= data set option in the SET statement renames variables in the input data set. You can use the new names in programming statements for the current DATA step. " - SAS H
And D






Question :

The following SAS program is submitted:
data work.passengers;
if OrigPassengers = . then
OrigPassengers = 100;
TransPassengers = 100;
OrigPassengers = .;
NonPaying = 10;
TotalPassengers = sum (OrigPassengers, TransPassengers);
run;
Which one of the following is the value of the TOTALPASSENGERS variable in the output data set?



  :
1. 100
2. 110
3. Access Mostly Uused Products by 50000+ Subscribers
4. . (missing numeric value)



Correct Answer : Get Lastest Questions and Answer :

Explanation: PDV initializes all variables in data step to missing first. So if statement yields true, so value of origpassenger becomes 100. Then transpassenger is assigned value of 100.
Next step value of origpassenger is overwritten with missing value. So when you add using sum function which ignores missing value, values of orignpassenger and transpassenger ie
sum(.,100) gives you 100. Thus answer is 1.





Question :

The following SAS program is submitted:
data work.staff;
JobCategory = 'FA';
JobLevel = '1';
JobCategory = JobCategory || JobLevel;
run;
Which one of the following is the value of the variable JOBCATEGORY in the output data set?

  :
1. FA
2. FA1
3. Access Mostly Uused Products by 50000+ Subscribers
4. ' ' (missing character value)

Correct Answer : Get Lastest Questions and Answer :

Explanation: length of JobCategory already set to 2 by the first assignment statement

jobcategory='FA';

after this jobcategory variable's length is two bytes,it can hold only two bytes.

Eventhough there is no mistake in the step

jobcategory=jobcategory || joblevel;

jobcategory carries the value FA.

behind the scenes:
1. the PDV writes the variables jobcategory (length 2) joblevel (length 1)with missing values
2. at the execution jobcategory gets FA and joblevel gets 1
3. Access Mostly Uused Products by 50000+ Subscribers

Actual value of the variable jobcatogery is FA1 How ever since sas first finds the value of Job category as FA it sets the length to 2 hence 1 is finally discarded from FA1 to make
up to a length of 2.




Related Questions


Question : You have been given below program

data course2017 ;
input COURSE_ID 1-3 COURSE_NAME$ 5-20 LOCATION$ 22-30 FEE 32-35 DATE$ 36-47
DURATION 48-50;
DROP FEE;
TotalFee=(FEE*18/100)+FEE;
RETAIN ENTIREFEE 100000;
ENTIREFEE+TotalFee;
if LOCATION in ('PUNE','JODHPUR') then FEETYPE=MEDIUM;
length FEETYPE $ 8;

In this case what would be the length of a variable FEETYPE?

 : You have been given below program
1. 8

2. 6

3. Access Mostly Uused Products by 50000+ Subscribers

4. Not known



Question : In which of the following program either DROP or KEEP is wrongly used

 : In which of the following program either DROP or KEEP is wrongly used
1. data course2017 ;
input COURSE_ID 1-3 COURSE_NAME$ 5-20 LOCATION$ 22-30 FEE 32-35 DATE$ 36-47
DURATION 48-50;
DROP FEE;
TotalFee=(FEE*18/100)+FEE;
RETAIN ENTIREFEE 100000;
ENTIREFEE+TotalFee;

2. proc print data=course2017 lable;
DROP TotalFee;
var COURSE_ID COURSE_NAME LOCATION DATE DURATION ENTIREFEE MESSAGE ;
run;



3. Access Mostly Uused Products by 50000+ Subscribers
input COURSE_ID 1-3 COURSE_NAME$ 5-20 LOCATION$ 22-30 FEE 32-35 DATE$ 36-47
DURATION 48-50;
DROP FEE;
TotalFee=(FEE*18/100)+FEE;
RETAIN ENTIREFEE 100000;
ENTIREFEE+TotalFee;


4. data course2017 ;
input COURSE_ID 1-3 COURSE_NAME$ 5-20 LOCATION$ 22-30 FEE 32-35 DATE$ 36-47
DURATION 48-50;
DROP FEE;
KEEP COURSE_NAME;
TotalFee=(FEE*18/100)+FEE;
RETAIN ENTIREFEE 100000;
ENTIREFEE+TotalFee;




Question : You have been given below step

data course2017_1 (drop=DATE DURATION);
set course2017 (keep=COURSE_NAME FEE DATE DURATION);
run;

After running this which of the columns will be in the output?

 : You have been given below step
1. COURSE_NAME FEE DATE DURATION

2. DATE DURATION

3. Access Mostly Uused Products by 50000+ Subscribers

4. ERROR



Question : Which of the following is considered correct program to generate dataset named course_?

 : Which of the following is considered correct program to generate dataset named course_?
1. data course2017_1 (drop=DATE DURATION);
set course2017 (keep=COURSE_NAME DURATION FEE DATE );
if DURATION<25;
TOTALFEE=TOTALFEE+FEE;
run;


2. data course2017 (drop=DATE DURATION);
set course2017_1 (keep=COURSE_NAME DURATION FEE DATE );
if DURATION<25;
TOTALFEE=TOTALFEE+FEE;
run;


3. Access Mostly Uused Products by 50000+ Subscribers
set course2017 (keep=COURSE_NAME FEE DATE );
if DURATION<25;
TOTALFEE=TOTALFEE+FEE;
run;


4. data course2017_1 (drop=DATE DURATION);
set course2017 ;
if DURATION<25;
TOTALFEE=TOTALFEE+FEE;
run;



Question : You have written following program using By statement

data courses2017_1;
set courses;
by course_name;
if first.course_name then TOTALFEE=0;
TOTALFEE+FEE;
if last.course_name;
run;

Which of the following statements are correct?

A. Dataset courses has to be sorted by course_name
B. There two variables will be created FIRST and LAST for the course_name variable.
C. FIRST and LAST are the two variables in each By group which represent first and last observation of that group.
D. FIRST and LAST variable will be stored with the dataset courses2017_1.

 : You have written following program using By statement
1. A,B,C
2. B,C,D
3. Access Mostly Uused Products by 50000+ Subscribers
4. A,B,D


Question : You have been given below SAS program what would be the result when you execute it?

data course2017;
input COURSE_ID 1-3 COURSE_NAME$ 5-20 LOCATION$ 22-30 FEE 32-35 DATE$ 36-47
DURATION 48-50;
obsnum=5;
stop;
datalines;
100 SAS MUMBAI 5000 01-JAN-2017 30
101 MACHINE PUNE 7000 01-FEB-2017 24
102 MACHINE PUNE 7000 01-MAR-2017 24
103 HADOOP BANGLORE 8000 01-APR-2017 40
104 HADOOP BANGLORE 9000 01-MAY-2017 30
105 SPARK CHENNAI 7000 01-JUN-2017 32
106 SPARK CHENNAI 6500 01-JUL-2017 30
107 SPARK CHENNAI 6500 01-AUG-2017 30
108 HADOOP AHMEDABAD 5000 01-SEP-2017 24
109 SAS MUMBAI 5000 01-OCT-2017 24
110 SAS JODHPUR 5000 01-NOV-2017 24
;
run;

 : You have been given below SAS program what would be the result when you execute it?
1. It will be generating 5 observation in the output

2. It will generate 1 observation in output

3. Access Mostly Uused Products by 50000+ Subscribers

4. It will give error