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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 603 views
  • 0 likes
  • 3 in conversation