Subscribe Bookmark RSS Feed

write selected rows to a new file

awalts12

Community Trekker

Joined:

Dec 21, 2015

I have a script where I select rows from a table based on certain criteria:

dt << Select Where( :gender == "female" & :dx == "ild" );

How can I write these "selected rows" to a new file?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

awalts12,

Sounds like you have column A selected.  In that case JMP will subset the selected column and selected rows.

dt << Select Where( :gender == "female" & :dx == "ild" );

dt << Clear Column Selection();

sub=dt<<Subset(output table name(<Your Table Name>), Selected Rows(1));

9 REPLIES
dlee0416

Community Trekker

Joined:

Jun 11, 2014

Awalts12,

You should be able to do the following:

dt << Select Where( :gender == "female" & :dx == "ild" );

sub=dt<<Subset(output table name(<Your Table Name>), Selected Rows(1));

Dave

awalts12

Community Trekker

Joined:

Dec 21, 2015

This looks good ...

But it outputs only the first column (call it Column A) in each row. Is there a way to write the entire row (Columns A - Column R).

Thanks again

Solution

awalts12,

Sounds like you have column A selected.  In that case JMP will subset the selected column and selected rows.

dt << Select Where( :gender == "female" & :dx == "ild" );

dt << Clear Column Selection();

sub=dt<<Subset(output table name(<Your Table Name>), Selected Rows(1));

awalts12

Community Trekker

Joined:

Dec 21, 2015

Thanks for the help  - this works nicely.

One other question as I am new to JMP's syntax. How can I include a wild card in the "select Where" command.

For example

dt << Select Where( :name == "A*")

doesn't seem to work - I'd like to be able to select all names starting with an A.

Thanks again.

txnelson

Super User

Joined:

Jun 22, 2012

dt << Select Where(substr(:name,1,1) == "A");

Jim
awalts12

Community Trekker

Joined:

Dec 21, 2015

Back to the subset command, is there a way to suppress JMP from opening a new window with the subset of data?

I'm extracting 10 different subsets and then concatenating them together. So I need to generate each subset, but I don't need to see the subsets (except for debugging purposes) until they are concatenated. I have the concatenation coded fine, but every time i run my script I have to close the 10 "subset windows".

Thanks again

Avram

txnelson

Super User

Joined:

Jun 22, 2012

dt << select whee (substr(:name,1,1)=="A");

dt2 = dt << subset(invisible,selected columns(0), selected rows(1));

This will make the data table invisible to the user, however, it will still appear in the JMP Windows List.  You can substitute "Private" for "Invisible" and the new data table will be invisible to the user and the JMP Windows List.

Make sure you close the data tables when you are done with them,

close(dt2, nosave);

Jim

Jim
dlee0416

Community Trekker

Joined:

Jun 11, 2014

awalts12,

You can make the table invisible by doing the following and wrap it in a for loop to do all subsetting in one step.

dt << Select Where( :gender == "female" & :dx == "ild" );

dt << Clear Column Selection();

sub=dt<<Subset(output table name(<Your Table Name>), Selected Rows(1), Invisible);

ms

Super User

Joined:

Jun 23, 2011

The first column may have been selected. Try this to override any column selection:

sub = dt << Subset(output table name("my_sub"), Selected Rows(1), Selected Columns(0));