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.test;
length city $20;
city='Paris';
city2=trim(city);
run;

Which one of the following is the length of the city2 variable?


  :
1. 5
2. 6
3. Access Mostly Uused Products by 50000+ Subscribers
4. 20

Correct Answer : Get Lastest Questions and Answer :

Explanation: The LENGTH statement specifies that the variable city has a length of 20 characters. The TRIM function in the assignment statement for city2 removes trailing blanks from the
value. However, the length of the city2 variable is set to 20 because city has a length of 20, and SAS pads the trimmed value with extra blanks.

[Trim just deleting the space, but still the same variable lenth]
-
Variable length character is determined by its location and the first occurrence of the statement where the decision.
1 if the statement in length, its length is the length of the statement is assigned to the variable length;
(2) If the list INPUT statement, and there is no specified length, then use the default length of 8;
(3) If the SET statement (in their data set in the SET statement), the length of the variable in the data set that is its length;
4 If the first occurrence of a string is assigned to the variable, the variable length is the length of the string;
5 If it is the result of a function assigned to this variable, that variable length is to be determined according to the function. Such as the use trim (), substr (), then use the
first parameter is a variable length length; such as using put (), then the length of the variable is equal to the length of format; while repeat () function will set the default
variable length 200; etc.






Question :

60. A raw data record is listed below.

1---+----10---+----20---+---
$23,456 750

The following SAS program is submitted:

data bonus;
infile 'file-specification';
input salary $ 1-7 raise 9-11;
(insert statement here)
run;

Which one of the following statements completes the program and adds the values of salary and raise to calculate the expected values of the newsalary variable?



 :
1. newsalary=salary + raise;
2. newsalary=put(salary,comma7.) + raise;
3. Access Mostly Uused Products by 50000+ Subscribers
4. newsalary=put(salary,comma7.) + put(raise,3.);

Correct Answer : Get Lastest Questions and Answer :

Explanation: You must convert the value of salary from character to numeric in order to perform an arithmetic function on it. You use the INPUT function to convert a character value to a
numeric value.

The following SAS program is submitted:

data work.travel;
do i=1 to 6 by 2;
trip + i;end; run;






Question : Which one of the following is the value of the variable trip in the output data set?

 :  Which one of the following is the value of the variable trip in the output data set?
1. 2
2. 3
3. Access Mostly Uused Products by 50000+ Subscribers
4. 10


Correct Answer : Get Lastest Questions and Answer :

Explanation: The sum variable in a sum statement is automatically set to 0 before the first observation is read from the data set. The sum variable in the statement above is increased
by the value of i on each iteration of the DO loop; the value of i is set to 1 on the first iteration of the DO loop and increases by 2 on each additional iteration until it is
greater than 6. Therefore, the value ofTripis equal to 0 + 1 + 3 + 5, which is 9.


Related Questions


Question : You have written a SAS data step, and you know that you will be reading lines from a raw file in this data step. Now there will be
iteration during the execution phase of data step. What is the correct with regards to beginning of each data step?

 : You have written a SAS data step, and you know that you will be reading  lines from a raw file in this data step. Now there will be
1. Both the automatic variable _N_ and _ERROR_ will be set to missing values.

2. Both the automatic variable _N_ and _ERROR_ will be set to 0.

3. Access Mostly Uused Products by 50000+ Subscribers

4. All the variables, which are part of observation will be set to missing.



Question : You have been given below SAS program
data HADOOPEXAM ;
infile "/folders/myfolders/hedata/filtered1.dat";
input COURSE_ID 1-3 COURSE_NAME$ 5-20 LOCATION$ 22-30 FEE 32-35 DATE$ 36-47
DURATION 48-50;
Total_FEE=FEE+FEE*18/100;
file print;
put COURSE_NAME Total_FEE COURSE_ID LOCATION$ FEE DATE DURATION;
run;

In which order the variables will be stored in SAS data set?


 : You have been given below SAS program
1. COURSE_NAME Total_FEE COURSE_ID LOCATION$ FEE DATE DURATION

2. Total_FEE COURSE_ID LOCATION$ FEE DATE DURATION COURSE_NAME

3. Access Mostly Uused Products by 50000+ Subscribers

4. COURSE_NAME COURSE_ID LOCATION$ FEE DATE DURATION Total_FEE



Question : You have written a SAS code, which is being reviewed by one of the peer member in your team, and he told that this code has syntax error,
but SAS compiler cannot find it, what would happen, once you run the program?

 : You have written a SAS code, which is being reviewed by one of the peer member in your team, and he told that this code has syntax error,
1. All the variable will be initialized with the missing values.

2. All the observation once the program executed will have missing values.

3. Access Mostly Uused Products by 50000+ Subscribers

4. Program will not be able to execute



Question : Is there anything wrong with the below program
data HADOOPEXAM ;
infile "/folders/myfolders/hedata/filtered1.dat"
input COURSE_ID 1-3 COURSE_NAME$ 5-20 LOCATION$ 22-30 FEE 32-35 DATE$ 36-47
DURATION 48-50;
Total_FEE=FEE+FEE*18/100;
run;

 : Is there anything wrong with the below program
1. You must put semicolon on each line. Semicolon missing on line 2 and 3

2. Semicolon is required in line 3 only

3. Access Mostly Uused Products by 50000+ Subscribers

4. You must put semicolon in line 2



Question : You can see following log is printed after execution of SAS program.
NOTE: Invalid data for COURSEID in line 7 15-19.
RULE: ----+----1----+----2----+----3----+----47
MUMBAI SPARK 3 5000
LOCATION=MUMBAI COURSEID=. COURSE_NAME=SPARK FEE=5000
Total=100 _ERROR_=1 _N_=1

What can you interpret from this?

 : You can see following log is printed after execution of SAS program.
1. There is a Syntax error and you have not used SAS keywords correctly.

2. All the columns are not kept in the correct order

3. Access Mostly Uused Products by 50000+ Subscribers

4. A dollar sign was missing in the INPUT statement.



Question : You have defined a SAS format as below.
proc format ;
value location
1='Mumbai'
2='Pune'
3='Chennai';
Run;
How long this format will be available?

 : You have defined a SAS format as below.
1. For the new PROC and DATA step only

2. For Next DATA step only.

3. Access Mostly Uused Products by 50000+ Subscribers

4. It will be available permanently