Desktop productivity for business analysts and programmers

creating table

Reply
N/A
Posts: 1

creating table

I have a very simple question-

I need to create a table with around 600 variables that, for many, are in the form A1 A2 A3 etc. Is there a way to quickly create these variables other than typing them into the table through the GUI and once they are there, is there a way to kind of 'find and replace' or rename? ex: A1 becomes B1 etc.

Thanks
Respected Advisor
Posts: 4,137

Re: creating table

Hi aabb

That's how you create the numeric vars A1-A600 and the character vars B1-B600;

data want;
array A {600};
array B {600} $10;
run;
proc contents data=want short;
quit;

The renaming part you asked for would also be possible but needs a bit more programming.

Why do you need this renaming? It sounds a bit odd...

Regards, Patrick
Super User
Posts: 5,388

Re: creating table

You can use variable lists in the rename statement/data set option:


data rename;
set want(rename=(a1-a600 = c1-c600));
run;

/Linus
Data never sleeps
Ask a Question
Discussion stats
  • 2 replies
  • 108 views
  • 0 likes
  • 3 in conversation