Base SAS Certification Questions Series - Part 4

The Global SAS certification exam is administered by SAS and Pearson VUE together. There are 60-65 multiple choice questions in Base SAS certification exam and candidate must achieve 70% score to pass multiple choice questions in  110 minutes.

We had started a series of articles to help you prepare for this examination. Here comes the fourth one covering few more.



Q10. The following SAS program is submitted:

Data work.test;
Author = 'Agatha Christie';
First = substr(scan(Author,1,' '),1 ,1);
Run;

Which one of the following is the length of the variable FIRST in the output data set?

A. 1
B. 6
C. 15
D. 200

Answer of the question is highlighted.

Explanation: 

Here, we need to understand how variables are created in PDV(Program Data Vector). In PDV first the variables Author will be created with the length of (15 bytes / 15 characters) because of number of letters between the strings of the assignment statement  Author = 'Agatha Christie';
Since the source variable in the assignment statement  First = substr(scan(Author,1,' '),1 ,1); is Author, so variable First will have the same length of (15 bytes / 15 characters). 



Q11. The following SAS program is submitted:

Data work.test;
First = 'lpswich, England';
City = substr(First,1,7);
City_Country = City||' , ' || 'England';
run;

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

A. lpswich!!
B. lpswich, England
C. lpswich, ‘England’
D. lpswich         , England

Answer of the question is highlighted.

Explanation: 
Again, in PDV the variable City is created with length of 16 bytes, because the source variable for City is Name and has a length of 16 bytes with trailing blanks. Thus, variable City_Country will concatenate 'lpswich         ' and 'England'.



Q12. The following SAS program is submitted:

data work.flights;
destination = ‘CPH’;
    select(destination);
      when(’LHR’) city = ‘London’;
      when(’CPH’) city = ‘Copenhagen’;
    otherwise;
    end;
run;

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

A. London
B. Copenh
C. Copenhagen
D. ‘ ‘(missing character value)

Answer of the question is highlighted.

Explanation: 
Here, the first when condition will specify the length  to 6 bytes, thus the length will remain same in this data step and city will keep only 6 character ( Copenhagen).



Enjoy reading our other articles and stay tuned with ...

Kindly do provide your feedback in the 'Comments' Section and share as much as possible.

No comments:

Post a Comment

Do provide us your feedback, it would help us serve your better.