BookmarkSubscribeRSS Feed
2Whitty
Calcite | Level 5

Hello,

I am merging two rather large datasets each of which contain 4,000 variables and they both have the same variable names.

Given the large number of variables, I am wondering if there a SAS procedure that would allow me to rename all of the variables in a single dataset at once? Perhaps by adding a simple suffix or prefix?

 

I Googled around and found some PROC SQL options however, I am simply not familiar  with SQL so the code was not very clear.

 

I am using SAS version 9. 

 

Any help or references would be appreciated.

 

Thank you.

6 REPLIES 6
Reeza
Super User

If they have the same variable names are you sure you want a merge and not an append?

 

Although it doesn't matter for this question you a SAS version is along the lines of 9.3 or 9.4 not just 9. 

2Whitty
Calcite | Level 5
OH!!! Yes... well I think I want to Append.
One dataset includes the children and the other include the mothers they
are to be merged(?) using a family ID.
Both groups completed the same questionnaire (hence the same variable
names) however now I am tasked with bringing them both together.
Appending sounds like a reasonable direction. I will Google that
procedure, right now!

##- Please type your reply above this line. Simple formatting, no
attachments. -##
RW9
Diamond | Level 26 RW9
Diamond | Level 26

4000 variables in multiple datasets, that really does not sound like an efficient or easy way to be working.  Personally I wouldn't work with any dataset having more than 30 odd variables, its just unworkable.  Consider a restructure.

Ronein
Meteorite | Level 14

What does it mean restructure?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 5899 views
  • 0 likes
  • 5 in conversation