BookmarkSubscribeRSS Feed
aabb
Calcite | Level 5
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
2 REPLIES 2
Patrick
Opal | Level 21
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
LinusH
Tourmaline | Level 20
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 2 replies
  • 1034 views
  • 0 likes
  • 3 in conversation