BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AndyK_
Calcite | Level 5

I have 11 sets I'd like to merge into one very wide set, but I want to check for duplicate variables first.  For example, I know a number of the sets have a variable named "notes", so I'll need to rename them in each set (notes1, notes2, etc) so they don't get overwritten.  Each set has a common ID to merge on.

A PROC COMPARE on two of the sets confirms that "notes" is the only variable I need to worry about, but that just checks two sets.  It doesn't seem very efficient to run PROC COMPARE on each combination before the merge (or even 10 combinations off some sort of "master set"). PROC SQL isn't any prettier since it's 10 joins.

I can write a PROC COMPARE macro but that seems like overkill for what's essentially "find duplicate variables among these sets".  Does anyone have a systematic way of checking for duplicate variables when merging more than two sets?


1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Use the sashelp.vcolumn table instead and search for duplicate variable names for the tables of interest.

View solution in original post

2 REPLIES 2
Reeza
Super User

Use the sashelp.vcolumn table instead and search for duplicate variable names for the tables of interest.

AndyK_
Calcite | Level 5

Terrific, thanks Reeza!  I ordered by name and can easily flag the dupes by hand.  It will be straightforward to automate for future use if we so desire.

Cheers,

Andy

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1528 views
  • 0 likes
  • 2 in conversation