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
A
ReplyDeleteA
ReplyDeleteA
ReplyDeleteContained in the output data set?
ReplyDeleteA.
Shouldnt the answer be D?
ReplyDeleteArray 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.
DeleteI 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...
ReplyDeleteans is A just run it in sas and see output;
Deletedata work.test;
array agents{4} $ 12 sales1 - sales4;
run;
Array elements will be written into a data set. But array name is not a variable, not written into a data set.
Deletearray named 'agents' is temporary but variables created by array sales1- sales4 are stored in dataset.
ReplyDeleteD 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.
sorry A is the ans.
DeleteA
ReplyDeletenice post
ReplyDeleteappvn download
tutuapp apk ios