BookmarkSubscribeRSS Feed
Francisco
Calcite | Level 5

Hello. I've a little problem. How can I join 2 tables and keep the data of columns with the same name? The data of 2 tables is different, and i need make a new table with the result.

The name of tables are:

  • Directa
  • Folios

And the same columns of both tables are called "Burks" and "Blartd". The output must be create a new table, with the name "Final".

Thanks in advanced.

Francisco

4 REPLIES 4
Barnipaz
Obsidian | Level 7

The answer is easy: no.

You can rename the two column in input

data final;

  merge Directa Folios (rename=(Burks=folios_Burks Blartd=folios_Blartd));

  by xxx;

run;

If you append you can.

Francisco
Calcite | Level 5

Hi.Thanks for the answer. I try to explain with more details:

Dataset P1

PositionCodeClass
1AFA
2AGB
3AHC
4AID
5AJE

Dataset P2

PositionCode
6AA
7AB
8AC
9AD
10AE

And I need the new data set call P_New:

PositionCodeClass
1AFA
2AGB
3AHC
4AID
5AJE
6AA
7AB
8AC
9AD
10AE

Thanks in advanced for your help.

Regards,

Francisco

Barnipaz
Obsidian | Level 7

It's an append.

Ypu can do with a datastep

data new;

  set pi_1 P_new;

run;

Or with the proc append.

Proc append base=P_1 data=P_new force; run;

The code is written by memory so some error could be in it. Test it and change it.

overmar
Obsidian | Level 7

Or you can just stack them

data final;

     set     Directa

               Folios;

run;

As long as they are in the same positions, ie the data that you had presented earlier this will just stack the two of them on top of each other.

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!

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