Subscribe Bookmark RSS Feed

How to export rows/columns from different files to the same output table

gutloja

Community Trekker

Joined:

Jul 31, 2015

[Exporting rows/columns from different files]

Hello, All.

I am exporting columns that meet certain criteria [which I select using "select where"].

How do I export from different files at once to the same "output table"?

How do I delete columns from the original files?

[File size increases significantly if I save the database with calculations]

This is the script I use to export from one file at the time.

Thank you!

dt =Current Data Table();

dt << select where( :Condition == 1 );

Data Table( "DataSet1.jmp" ) <<

Subset(

    Output Table( "Subset1" ),

    Selected Rows( 1 ),

    columns(

        :TIMESTAMP,

        :Measurement_series_ID,

        :Name( "Var1" ),

        :Name( "Var2" ),

        :Name( "Var3" ),

        :Name( "Var4" ),

        :Name( "Var5" ),

        :Name( "Var6" )

    )

);

1 REPLY
txnelson

Super User

Joined:

Jun 22, 2012

The typical flow of a script that creates a single output table from multiple input tables would be to:

1. Subset required data from table 1.

2  Subset required data from table 2.

3. Join or concatenate the data together.

4. Subset the required data from table 3

5. Join or concatenate the data from the first joined/concatenated table with table 3.

The following is a simplified script that illustrates one way of handling the issue where data tables are cumbersom because of their size.

Names Default to Here(1);

dt1=Open(<Open the first data table>);

dt1<<select where(:condition == 1);

Mvar1=dt1:var1[dt1<<get selected rows];

close(dt1,nosave);

nt=new table("output table");

nt<<new column("var1",values(Mvar1));

dt2=Open(<Open the second data table>);

dt2<< select where(:condition==2);

Mvar2=dt2:varX[dt2<<get selected rows];

close(dt2,nosave);

nt<<new column("varx", values(Mvar2));

......

To answer your question about how to delete columns in a data table, a simple delete columns message is passed to the data table you want to delete the columns from:

      dt<<delete columns({"varname1","varname2","varname3"});

All of these items are covered in the Scripting Guide available from the pull down menus in JMP.

    Help==>Books==>Scripting Guide

Jim