DATA Step, Macro, Functions and more

Can I use array to append multiple datasets ?

Reply
Contributor
Posts: 22

Can I use array to append multiple datasets ?

data a1 a2 a3;

input x;

cards;

1

2

3

;

 

I want a1 a2 a3 to be appended into a single dataset using an array. Please, suggest. 

 

Super User
Super User
Posts: 8,279

Re: Can I use array to append multiple datasets ?

Posted in reply to Arun_shSAS

Why not just use a SET statement?

data want ;
  set a1-a3 ;
run;
Contributor
Posts: 22

Re: Can I use array to append multiple datasets ?

Using array.
Super User
Super User
Posts: 8,279

Re: Can I use array to append multiple datasets ?

[ Edited ]
Posted in reply to Arun_shSAS

Arun_shSAS wrote:
Using array.

That does not make any sense. The ARRAY statement in SAS is used as a way to make it easy to treat a series of variables as if they formed an array of values.  It has nothing whatsoever to do with datasets.

Esteemed Advisor
Posts: 5,624

Re: Can I use array to append multiple datasets ?

Posted in reply to Arun_shSAS

Your code will produce 3 identical datasets, each containing 3 observations. If you want just one dataset, use

 

data A;

input x;

cards;

1

2

3

;

PG
Ask a Question
Discussion stats
  • 4 replies
  • 202 views
  • 1 like
  • 3 in conversation