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.

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register 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
  • 2129 views
  • 1 like
  • 4 in conversation