By admin | August 14, 2009

SAS Certified Adv Programmer 50 Questions (21)

The following SAS program is submitted at the start of a new SAS session:

%macro trans;
    %let type=Airplane;
    proc print data=sasuser.activities;
        where trans="&type";
    run;
    %location(Automobile)
    %put type is &type;
%mend;

%macro location(type);
    data _null_;
        call symput('type', 'Train');
    run;
%mend;
%trans

Which one of the following is written to the log by the %PUT statement?

a. type is &type
b. type is Train
c. type is Airplane
d. type is Automobile

By admin | August 13, 2009

SAS Certified Adv Programmer 50 Questions (20)

The following SAS program is submitted:

%let a=cat;

%macro animal;
    %let a=dog;
%mend;
%animal
%put a is &a;

Which one of the following is written to the SAS log?

a.

a is

b.

a is &a

c.

a is cat

d.

a is dog
By admin | August 13, 2009

SAS Certified Adv Programmer 50 Questions (19)

The following SAS program is submitted:

data towns;
    input City $ pop year;
cards;
ANDOVER 75000 1998
CARY 80000 1998
ANDOVER 14000 1977
CARY 71000 1986
;

%macro a(location);
    data a;
        set towns;
    %if &location=UK %then %do;
        where city='ANDOVER';
    %end;
    %if &location=NC %then %do;
        where city='CARY';
    %end;
    if pop>70000;
    run;
%mend;
%a(UK)

Which one of the following represents the resulting output in the SAS data set A?

a. 1 observation with the value of CARY for the variable City
b. 2 observations with the value of CARY for the variable City
c. 1 observation with the value of ANDOVER for the variable City
d. 2 observations with the value of ANDOVER for the variable City

By admin | August 13, 2009

SAS Certified Adv Programmer 50 Questions (18)

The following SAS program is submitted:

%let code=set old (keep=A B);
    Newvar=a || b;
run;

data new;
    &code
run;

proc print data=new;
run;

Which one of the following is the result of the above program?

a. There will be errors in the log and no report.
b. There will be no report and no errors in the log.
c. There will be a report that has only the variables A and B.
d. There will be a report that has the variables A, B, and Newvar.

By admin | August 13, 2009

SAS Certified Adv Programmer 50 Questions (17)

The following SAS program is submitted:

%let sun=SHINE;
%let shine=MOON;

proc print data=weather(keep=sun shine moon);
    sum &&&&sun;
run;

Which one of the following variables is summed in the resulting report?

a. sun
b. MOON
c. SHINE
d. None, an ERROR message will be written to the log.