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.accounting;
set work.dept1 work.dept2;
run;
A character variable named JOBCODE is contained 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?

  :
1. 5
2. 7
3. Access Mostly Uused Products by 50000+ Subscribers
4. 12


Correct Answer : Get Lastest Questions and Answer :

Explanation: The "set statement" takes the length of the common variable, as the length of that variable in the first dataset of set statement.

The length of a variable always define automatically in the first statement and remain unchanged during the whole program until and unless we redefine it.

So when DEPT1 is set the lenght will set to 5 and remail unchanged during the data step






Question :
The following SAS DATA step is submitted:
data work.accounting;
set work.department;
length jobcode $ 12;
run;
The WORK.DEPARTMENT SAS data set contains a character variable named JOBCODE with a length of 5.
Which one of the following is the length of the variable JOBCODE in the output data set?


  :
1. 5
2. 8
3. Access Mostly Uused Products by 50000+ Subscribers
4. The length can not be determined as the program fails to execute due to errors.

Correct Answer : Get Lastest Questions and Answer :

Explanation: This is the log error after we run this program.

/* WARNING: Length of character variable has already been set.
Use the LENGTH statement as the very first statement in the DATA STEP to declare the length
of a character variable.
*/
The base dataset has already the length set as 5 if you try to reset after set statement it gives you a warning.






Question :
Which one of the following SAS statements renames two variables?

  :
1. set work.dept1
work.dept2(rename = (jcode = jobcode)
(sal = salary));
2. set work.dept1
work.dept2(rename = (jcode = jobcode
sal = salary));
3. Access Mostly Uused Products by 50000+ Subscribers
work.dept2(rename = jcode = jobcode
sal = salary);
4. set work.dept1
work.dept2(rename = (jcode jobcode)
(sal salary));



Correct Answer : Get Lastest Questions and Answer :

Explanation: After the first open brackets you place the rename keyword then open new brackets again to place all the renaming variables: ie

(rename= (oldvar1=newvar1 oldvar2=newvar2));

All the other answers have bad syntax.




Related Questions


Question : You have been given below code
if course_fee>=4000
and (COURSE_NAME='HADOOP' or (COURSE_NAME='SPARK' and STUDENTS=24))
then LOCATION='MUMBAI';

Which of the expression will be executed first?

 : You have been given below code
1. if course_fee>=4000

2. (COURSE_NAME='SPARK' and STUDENTS=24)

3. Access Mostly Uused Products by 50000+ Subscribers

4. Can not be predicted and will be optimized by SAS engine



Question : You have been given below values in a variable name TotalFee
5000
.
7000
Once you execute below statement, what would be the ENTIREFEE values at end of execution
ENTIREFEE+TotalFee

 : You have been given below values in a variable name TotalFee
1. Missing

2. Null

3. Access Mostly Uused Products by 50000+ Subscribers

4. 22000

5. 22



Question : You have been given below values in a variable name TotalFee
5000
.
7000
Once you execute below statement, what would be the ENTIREFEE values at end of execution
RETAIN ENTIREFEE 5000;
ENTIREFEE+TotalFee;

When you are at the 4th observation than what would be the value of ENTIREFEE

 : You have been given below values in a variable name TotalFee
1. 0

2. Null

3. Access Mostly Uused Products by 50000+ Subscribers

4. 22000

5. 17000



Question : You have been given below data

With the following SAS statements
If course_name=SAS AND DURATION=30
Then FEE=10000;
If LOCATION=PUNE or COURSE_ID=100
Then MESSAGE=LOW;

What would the correct values of the variable?

 : You have been given below data
1. FEE=5000 MESSAGE=LOW

2. FEE=10000 MESSAGE=LOW

3. Access Mostly Uused Products by 50000+ Subscribers

4. FEE=10000 MESSAGE=



Question : Which is the correct statement regarding length of a variable in a SAS program?
A. As soon as variable appear in data step and its value derive the length.
B. Whatever length explicitly defined will be the length of that variable
C. As soon as you do the assignment

 : Which is the correct statement regarding length of a variable in a SAS program?
1. A,B
2. B,C
3. Access Mostly Uused Products by 50000+ Subscribers
4. A,C


Question : You have been given below program
If course_name=SAS then fee=7000;
If course_name=HADOOP then FEE=8000;
If course_name^=HADOOP and COURSE_NAME^=SAS then FEE=5000;

Which of the following SAS program will be the same as given above?

 : You have been given below program
1. IF COURSE_NAME=SAS then FEE=7000;
Else if COURSE_NAME=HADOOP then FEE=8000;
Else FEE=5000;


2. IF COURSE_NAME=SAS then FEE=7000;
if COURSE_NAME=HADOOP then FEE=8000;
Else FEE=NULL;


3. Access Mostly Uused Products by 50000+ Subscribers
Else COURSE_NAME=HADOOP then FEE=8000;
Else FEE=5000;


4. IF COURSE_NAME=SAS then FEE=7000;
SELECT if COURSE_NAME=HADOOP then FEE=8000;
Else FEE=5000;