By admin | August 10, 2009

SAS Certified Base Programmer 50 Questions (46)

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?

a. newsalary=salary + raise;
b. newsalary=put(salary,comma7.) + raise;
c. newsalary=input(salary,comma7.) + raise;
d. newsalary=put(salary,comma7.) + put(raise,3.);

By admin | August 10, 2009

SAS Certified Base Programmer 50 Questions (45)

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?

a. 5
b. 6
c. 8
d. 20

By admin | August 10, 2009

SAS Certified Base Programmer 50 Questions (44)

The following SAS program is submitted:

proc contents data=sasuser._all_ nods;
run;

Which one of the following is produced as output?

a. the list of all data set names in the Sasuser library only
b. the descriptor portion of the data set named Sasuser._All_
c. the descriptor portion of every data set in the Sasuser library only
d. the list of data set named in the Sasuser library plus the descriptor portion of every data set in the Sasuser library.

By admin | August 10, 2009

SAS Certified Base Programmer 50 Questions (43)

The following SAS program is submitted:

libname sasdata 'SAS-data-library';
libname labdata 'SAS-data-library';
data labdata.boston
     labdata.dallas(drop=city dest equipment);
    set sasdata.cities(keep=orig dest city
                       price equipment);
    if dest='BOS' then output labdata.boston;
    else if dest='DFW' then output labdata.dallas;
run;

Which variables are output to both data sets?

a. price and orig only
b. city and equipment only
c. city, price, and equipment only
d. city, price, orig, and equipment

By admin | August 10, 2009

SAS Certified Base Programmer 50 Questions (42)

Assume that SAS data sets Sasdata.Products and Sasdata.Sales both contain the Prod_ID variable. Which of the following SAS DATA steps returns only exceptions or non matches?

a.

libname sasdata 'SAS-data-library';
data all;
    merge sasdata.products
          sasdata.sales;
    by prod_id;
    if ins=1 or inp=1;
run;

b.

libname sasdata 'SAS-data-library';
data all;
    merge sasdata.products(in=inp)
          sasdata.sales(in=ins);
    by prod_id;
    if ins=1 and inp=1;
run;

c.

libname sasdata 'SAS-data-library';
data all;
    merge sasdata.products(in=inp)
          sasdata.sales(in=ins);
    by prod_id;
    if ins=0 and inp=0;
run;

d.

libname sasdata 'SAS-data-library';
data all;
    merge sasdata.products(in=inp)
          sasdata.sales(in=ins);
    by prod_id;
    if ins=0 or inp=0;
run;