ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 76

The following SAS program is submitted:
data work.test;
set work.staff (keep = jansales febsales marsales);
array diff_sales{3} difsales1 - difsales3;
array monthly{3} jansales febsales marsales;
run;
Which one of the following represents the new variables that are created?
A. JANSALES, FEBSALES and MARSALES
B. MONTHLY1, MONTHLY2 and MONTHLY3
C. DIFSALES1, DIFSALES2 and DIFSALES3
D. DIFF_SALES1, DIFF_SALES2 and DIFF_SALES3
Click Comment link to get answer

14 comments:

  1. Anonymous7:38 AM

    C is the correct answer

    ReplyDelete
    Replies
    1. An sis C becoz other 3 var are not new but coming from data set being read as its option say in keep..
      hope it helps

      Delete
  2. Anonymous8:21 AM

    some one can please expalain to me, I am not clear about Array

    ReplyDelete
  3. Anonymous6:17 PM

    synatx:array array_name(len_ofarray) var_list;
    var_list could be new or existing vars in datasets.
    in the above program, dif_sales1- dif_sales3 are new.
    bcos,jansales,febsales,marsales are existing in work.staff dataset.
    diff_sales is the array name.

    ReplyDelete
  4. Anonymous10:41 PM

    ans is c

    ReplyDelete
  5. Anonymous4:55 PM

    array diff_sales{3} difsales1 - difsales3;

    This above statement creates three new variables diff_sales1, diff_sales2, and diff_sales3 because they don't already exist in the WORK.STAFF dataset.

    ReplyDelete
  6. Anonymous6:36 AM

    so are two Anonymous people saying that the answer is D?

    i think it's C.

    On the book it says

    ARRAY array-name(dimensino)
    "if no elements are listed, new variables will be created with DEFAULT NAME"

    On here, what is "DEFAULT NAMEs refering to?
    Thx in advance.

    ReplyDelete
  7. Default name refers to diff_sales1 diff_sales2 diff_sales3 respectively as opposed to the user defined difsales1 - difsales3 which yields difsales1 difsales2 difsales3.

    ReplyDelete
  8. Anonymous5:08 AM

    why is it not the option B? can anyone explain the second array statement?

    ReplyDelete
  9. Anonymous12:19 PM

    The answer is C.. the reason is if you look at the set statement : 'set work.staff (keep = jansales febsales marsales);' jansales, febsales, marsales are variables you are bringing in. The array: array diff_sales{3} difsales1 - difsales3;are the variables you want to create - since there is no other programming code to define the variables, SAS creates the variables the array defines. Since these arrays are numeric, the variables created are also numeric.

    ReplyDelete
    Replies
    1. Thank you for explaining
      Cheers!

      Delete
  10. Anonymous2:27 AM

    General form ARRAY statement:
    ARRAY array_name{dimension};

    If no elements are listed , new var.s will be created with default names.The default var. names are created by concatenating the array name and the numbers 1,2,3 and so on, upto the array dimension.If you prefer, you can specify individual var names. To specify var. names , you list each name as an element of the array.


    so the answer is c.

    ReplyDelete