- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
write selected rows to a new file
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
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));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
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));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
dt << Select Where(substr(:name,1,1) == "A");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: write selected rows to a new file
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));