BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jc3992
Pyrite | Level 9

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@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.

 

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
jc3992
Pyrite | Level 9

So I guess "array" is temporary but the array variables are not.

Was this what you meant?

 

Thank you!

PaigeMiller
Diamond | Level 26

The variables are not temporary.

--
Paige Miller
Reeza
Super User

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!


 

ballardw
Super User

@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.

 

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3128 views
  • 1 like
  • 4 in conversation