Premium

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



Question : You have been given below program

filename course81 '/folders/myfolders/hedata/course81.txt';

data data81 (drop=header);
infile course81 end=last;;
retain course_name;
input header $ @;

if header='C' then
do;

if _N_ >1 then
output;
TOTAL_LOCATIONS=0;
input course_name $;
end;
else if header='LF' then
TOTAL_LOCATIONS+1;
if last then output;
run;

what does here last variable used for?

A. It will always have value as 1, as soon as file read reach end of the record its value will be set to 0.
B. It will always have value as 0, as soon as file read reach end of the record its value will be set to 1
C. For each iteration its value will be written in output as well.
D. Value of last variable will never be written to output

 : You have been given below program
1. A,B
2. B,C
3. Access Mostly Uused Products by 50000+ Subscribers
4. A,D
5. B,D

Correct Answer : Get Lastest Questions and Answer :
Explanation: end=last will create a variable named last which will hold as a last line marker, if line is last than it will be set to 1 else
it always remain 0, and value of this variable will never be written to output.




Question : You have been given program and dataset



filename course81 '/folders/myfolders/hedata/course81.txt';

data data81 (drop=header);
infile course81 end=last;;
retain course_name;
input header $ @;

if header='C' then
do;

if _N_ >1 then
output;
TOTAL_LOCATIONS=0;
input course_name $;
end;
else if header='LF' then
TOTAL_LOCATIONS+1;
if last then output;
run;



What happened when this program will be executed ?

 : You have been given program and dataset
1. It will generate 3 observation in output

2. It will generate 4 observation in output

3. Access Mostly Uused Products by 50000+ Subscribers

4. It will generate 22 observation in output


Correct Answer : Get Lastest Questions and Answer :
Explanation: It will generate 5 observation in output, because if then do loop will read header record and hold it until all the detail
record have been read, once the detail record will real it will generate output for each data step. And last variable also help in finding that this is
the last record and generate the output hence there are 5 headers so 5 observation will be generated. Else it would have generated only 4 observation.

Related Questions


Question : You have been given below program

filename course81 '/folders/myfolders/hedata/course81.txt';

data data81 (drop=header);
infile course81 end=last;;
retain course_name;
input header $ @;

if header='C' then
do;

if _N_ >1 then
output;
TOTAL_LOCATIONS=0;
input course_name $;
end;
else if header='LF' then
TOTAL_LOCATIONS+1;
if last then output;
run;

what does here last variable used for?

A. It will always have value as 1, as soon as file read reach end of the record its value will be set to 0.
B. It will always have value as 0, as soon as file read reach end of the record its value will be set to 1
C. For each iteration its value will be written in output as well.
D. Value of last variable will never be written to output

 : You have been given below program
1. A,B
2. B,C
3. Access Mostly Uused Products by 50000+ Subscribers
4. A,D
5. B,D


Question : You have been given program and dataset



filename course81 '/folders/myfolders/hedata/course81.txt';

data data81 (drop=header);
infile course81 end=last;;
retain course_name;
input header $ @;

if header='C' then
do;

if _N_ >1 then
output;
TOTAL_LOCATIONS=0;
input course_name $;
end;
else if header='LF' then
TOTAL_LOCATIONS+1;
if last then output;
run;



What happened when this program will be executed ?

 : You have been given program and dataset
1. It will generate 3 observation in output

2. It will generate 4 observation in output

3. Access Mostly Uused Products by 50000+ Subscribers

4. It will generate 22 observation in output



Question : A SAS program is submitted and the following SAS log is produced:
2 data gt100;
3 set ia.airplanes
4 if mpg gt 100 then output;
22 202
ERROR: File WORK.IF.DATA does not exist.
ERROR: File WORK.MPG.DATA does not exist.
ERROR: File WORK.GT.DATA does not exist.
ERROR: File WORK.THEN.DATA does not exist.
ERROR: File WORK.OUTPUT.DATA does not exist.
ERROR 22-322: Syntax error, expecting one of the following: a name,
a quoted string, (, ;, END, KEY, KEYS, NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
5 run;
The IA libref was previously assigned in this SAS session.
Which one of the following corrects the errors in the LOG?

  : 	A SAS program is submitted and the following SAS log is produced:
1. Delete the word THEN on the IF statement.
2. Add a semicolon at the end of the SET statement.
3. Place quotes around the value on the IF statement.
4. Add an END statement to conclude the IF statement




Question : The contents of the raw data file CALENDAR are listed below:
--------10-------20-------30
The following SAS program is submitted:
data test;
infile 'calendar';
input @1 date mmddyy10.;
if date = '01012000'd then event = 'January 1st';
run;
Which one of the following is the value of the EVENT variable?


  : The contents of the raw data file CALENDAR are listed below:
1. 01012000
2. January 1st
3. (missing numeric value)
4. The value cannot be determined as the program fails to execute due to errors.



Question : The following SAS program is submitted:

data work.january;
set work.allmonths (keep = product month num_sold cost);
if month = 'Jan' then output work.january;
sales = cost * num_sold;
keep = product sales;
run;
Which variables does the WORK.JANUARY data set contain?

  : The following SAS program is submitted:
1. PRODUCT and SALES only
2. PRODUCT, MONTH, NUM_SOLD and COST only
3. PRODUCT, SALES, MONTH, NUM_SOLD and COST only
4. An incomplete output data set is created due to syntax errors