ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 75

The following SAS program is submitted:
data work.test;
array agents{4} $ 12 sales1 - sales4;
run;
Which one of the following represents the variables that are contained in the output data set?
A. SALES1, SALES2, SALES3, SALES4
B. AGENTS1, AGENTS2, AGENTS3, AGENTS4
C. None, the DATA step fails because the ARRAY statement can reference only numeric data.
D. None, the DATA step fails because the ARRAY statement can reference only pre-existing variables.
Click Comment link to get answer

13 comments:

  1. Anonymous1:54 PM

    Contained in the output data set?
    A.

    ReplyDelete
  2. Anonymous4:45 PM

    Shouldnt the answer be D?

    ReplyDelete
    Replies
    1. Array statement is also used to create variables and both variables 'char' as well as 'num'. Also, here agents is the array name, which can be used as a reference (though not used here) and the variable created is 'char' (due to the presence of $ in the statement with the lenght of 12) and had Sales1-Sales4 not being mentioned, the new variables would have been Agents1-Agents4.

      Delete
  3. Anonymous2:15 AM

    I thought arrays were temporary and didn't write to the data set....I thought that they were for processing and to be used with target variables...

    ReplyDelete
    Replies
    1. ans is A just run it in sas and see output;
      data work.test;
      array agents{4} $ 12 sales1 - sales4;
      run;

      Delete
    2. Anonymous5:55 PM

      Array elements will be written into a data set. But array name is not a variable, not written into a data set.

      Delete
  4. Anonymous11:39 AM

    array named 'agents' is temporary but variables created by array sales1- sales4 are stored in dataset.
    D is not correct, because we can define arrays for new variables to be created too.
    If we dont't give dimentions 'Sales1-sales4' only then variable named agents1-agents 4 will be stored in output dataset.So A is not right.
    so Bis the ans.

    ReplyDelete
    Replies
    1. Anonymous1:09 PM

      sorry A is the ans.

      Delete