Wednesday, November 9, 2011

SAS Exam Question 1

The following SAS program is submitted:
data work.AreaCodes;
Phonenumber=3125551212;
Code='('!!substr(Phonenumber,1,3)!!')';
run;
Which one of the following is the value of the variable Code in the output data set?
a. (  3)
b. (312)
c. 3
d. 312


Answer:   A (see the answer after replying the post )


Tips: the substr function convert the numerical variables to character variables, the length is 12, the format is best12.

No comments:

Post a Comment