BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
Reinaldo
Community Trekker

How can I concatenate columns from different JMP files?

Hi,

I have four different JMP files which contain the same column names. They were generated using "Table -> Subset by" from my main data table.

Now, I would like to concatenate those four JMP files in columns rather than rows into one JMP file.

How can I do it?

Thank you.

 

PS: I tried to use the feature Table -> JMP Query Builder. The idea is the same I wish, however it couldn't load the data from other three files into there (SQLQuery).

 

~Rei
0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
uday_guntupalli
Community Trekker

Re: How can I concatenate columns from different JMP files?

@Reinaldo
          When you say participants, let us take two of your tables ( say Table 1 and Table 2) - are you saying that Table 1 and Table 2 have the same # of columns and you would like to join them ? And when you join how would you like to perform the join : 

1. You can match columns - so if Table 1 & Table 2 have a column named "Age" then your resultant table will also have one column "Age" , but with all the rows in both the tables 

2. You can do a cartesian join 

3. Join By Row Number ? 

 

         Yes it is possible to perform Joins using the menu . Select one of your tables and navigate to Tables == > Join . The Join menu should look like this , now within this - depending on how you perform the join, your results will vary. I am presuming you want to select "By Matching Columns". Try that and see if that gives you what you are after, else please provide clear examples or screenshots. 

image.png

Best
Uday
5 REPLIES 5
uday_guntupalli
Community Trekker

Re: How can I concatenate columns from different JMP files?

@Reinaldo
     Are you looking to do a cartesian join ?  Please bear in mind the resulting table depending on the tables you are joining can be huge. So, provide an example of your data sets if this is not what you are looking for 

 

// Open Sample Data 
dt = Open( "$SAMPLE_DATA/Air Traffic.jmp" );

// Create a couple of sample tables 
dt << Select Randomly(0.01); 
dt1 = dt << Subset(""); 
dt1 << Set Name("Sample1"); 
dt << Clear Select ; 

dt << Select Randomly(0.01); 
dt2 = dt << Subset("");
dt2 << Set Name("Sample2");

dt << Clear Select; 


// Join COlumns ? 
dt_Res = dt1 << Join( With( dt2 ), Cartesian Join );
Best
Uday
0 Kudos
Reinaldo
Community Trekker

Re: How can I concatenate columns from different JMP files?

Hi @uday_guntupalli,

As I have the same number of participants, I just would like to add (or join) columns from different JMP files into one. I wasn't clear for me your script. Isn't it possible to combine those columns into one file using JMP menu?

I thought the JMP Query Builder could do it, but when I grouped all files, choosing one of them as Primary, only this file kept the information. Other files just added columns but the cells were completed empty.

~Rei
0 Kudos
uday_guntupalli
Community Trekker

Re: How can I concatenate columns from different JMP files?

@Reinaldo
          When you say participants, let us take two of your tables ( say Table 1 and Table 2) - are you saying that Table 1 and Table 2 have the same # of columns and you would like to join them ? And when you join how would you like to perform the join : 

1. You can match columns - so if Table 1 & Table 2 have a column named "Age" then your resultant table will also have one column "Age" , but with all the rows in both the tables 

2. You can do a cartesian join 

3. Join By Row Number ? 

 

         Yes it is possible to perform Joins using the menu . Select one of your tables and navigate to Tables == > Join . The Join menu should look like this , now within this - depending on how you perform the join, your results will vary. I am presuming you want to select "By Matching Columns". Try that and see if that gives you what you are after, else please provide clear examples or screenshots. 

image.png

Best
Uday
Reinaldo
Community Trekker

Re: How can I concatenate columns from different JMP files?

Hi @uday_guntupalli,

 

My main data is in the following format:

 

Subj    Phase   Subphase  Score

1               A            a              1

2               A            a              2

...

1               A            b              3

2               A            b              4

...

1               B            c              5

2               B            c              6

...

1               B            d              7

2               B            d              8

...

 

I clicked on Table -> Subset by "Phase" & "Subphase", and I got 4 files with the same column names.

I would like to combine like this:

 

Subj  Phase   Subphase  Score  Phase  Subphase  Score  Phase   Subphase  Score Phase   Subphase  Score

1           A              a             1          A            b             3          B              c             5         B             d              7

2           A              b             2          A            b             4          B              c             6         B             d              8

 

Yes, I think I can use "Join" to add columns... 

Thank you for your help.

 

 

~Rei
0 Kudos
Reinaldo
Community Trekker

Re: How can I concatenate columns from different JMP files?

It works, @uday_guntupalli! I just need to do it three times!

Thank you!

 

~Rei
0 Kudos