Hello everyone,
I wonder why we cannot select answer (a) for the following question?
Thank you!
13.) What is true about array variables?
Answer: b
@jc3992 wrote:
Hello everyone,
I wonder why we cannot select answer (a) for the following question?
Thank you!
13.) What is true about array variables?
- They are temporary variables created in datastep.
- They are output in dataset.
- Can contain numeric and character values at same time.
- Cannot be used in assignment statement.
Answer: b
Log result of pretty minimal program:
2598 data work.example; 2599 array a{5}; 2600 run; NOTE: The data set WORK.EXAMPLE has 1 observations and 5 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds
The first note following the data step shows that the output data set has 5 variables. Exercise for the interested reader is what are the variable names and why?
It is possible to create temporary array variables though:
2601 data work.example; 2602 array a{5} _temporary_ (1,2,3,4,5); 2603 run; NOTE: The data set WORK.EXAMPLE has 1 observations and 0 variables.
Of course a data set with no variables is not terribly interesting for most purposes.
I don't see answer (a) anywhere, do you mean the answer that is first under the question? If so, that is not correct because array variables are not temporary.
So I guess "array" is temporary but the array variables are not.
Was this what you meant?
Thank you!
The variables are not temporary.
If you declare an array the variables are cxreated in the output data set.
Not temporary, unless explicitly specified.
data want;
array a(20);
run;
proc contents data=want;run;
@jc3992 wrote:
So I guess "array" is temporary but the array variables are not.
Was this what you meant?
Thank you!
@jc3992 wrote:
Hello everyone,
I wonder why we cannot select answer (a) for the following question?
Thank you!
13.) What is true about array variables?
- They are temporary variables created in datastep.
- They are output in dataset.
- Can contain numeric and character values at same time.
- Cannot be used in assignment statement.
Answer: b
Log result of pretty minimal program:
2598 data work.example; 2599 array a{5}; 2600 run; NOTE: The data set WORK.EXAMPLE has 1 observations and 5 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds
The first note following the data step shows that the output data set has 5 variables. Exercise for the interested reader is what are the variable names and why?
It is possible to create temporary array variables though:
2601 data work.example; 2602 array a{5} _temporary_ (1,2,3,4,5); 2603 run; NOTE: The data set WORK.EXAMPLE has 1 observations and 0 variables.
Of course a data set with no variables is not terribly interesting for most purposes.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.