By admin | September 3, 2009

SAS Certified Base Programmer 123 Questions (16)

The following SAS program is submitted:

data work.empsalary;
    set work.people (in = inemp)
        work.money(in = insal);
    if insal and inemp;
run;

The SAS data set WORK.PEOPLE has 5 observations, and the data set WORK.MONEY has 7 observations. How many observations will the data set WORK.EMPSALARY contain?

A. 0
B. 5
C. 7
D. 12

6 comments | Add One

  1. admin - 09/3/2009 at 12:51 pm

    A

  2. sowmya - 12/20/2010 at 3:50 am

    can you please explain why the answer is A?

  3. urvish - 03/3/2011 at 6:18 am

    hi
    sowmya
    urvish here
    the answer is A jst coz here the condition of IF includes AND clause it means that if both the data sets contributed to all the observations then only observations vl written . and here one contains 5 obs and other contains 7 .
    if there OR comparision operator in IF condition then data set empsalary will append as usual .

  4. R - 04/6/2011 at 1:47 am

    Does it just check observation count…? That doesnt seem right.. Shouldnt it be looking for matching or intersection of rows where insal and inemp both are available?

  5. Sudha - 07/26/2011 at 2:34 am

    Hi,

    the ans is right, its because (in = inemp) and (in = insal) cannot be used with SET, it will cause error.
    So ‘0’ observation

  6. devika - 03/12/2012 at 7:33 pm

    Hi sudha
    urvish is correct, here the problem is If statement with AND combination.

Leave a Comment

Leave a Reply

Your email address will not be published.