Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 21, 2020 4:01 PM
(289 views)

We're often save graphs as scripts for later use. All works nicely until the graph involves data exclusion. For instance, we want to graph the recovery of patients who (1) received a vaccine vs. (2) those who didn't. The two graphs are identical – same variables, axis, labels, and style – except that (1) excludes the (binary) "no vaccine" condition and the (2) excludes the "vaccine" condition.

We understand that the graph updates itself whenever data exclusions are changed, (this is a feature, not a bug). **Is there a way to save the data exclusions in the graph's script**, so that whenever running the script, we'll see a result based on data exclusions when the graph was created?

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted
I now understand that when saving a graph's script, the data selection isn't automatically saved. We'll add the exclusions manually, based on your example below. Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

5 REPLIES 5

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to save graph script with data exlusions?

There are different ways to do this. If you want the graphs script to run against a new data table, then the script will require that JSL would need to be added to the script that goes through the data an makes the selections at that time. If the task is to just be able to rerun the graph with the same data table settings, then what needs to be done, is to create a new column of the type "Row State" and then save the Row States at the time the running of the graph to the new row state column. Then the graphic script would just have to be augmented to copy the save row states from the new column to the data table row states and then run the graph.

Jim

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to save graph script with data exlusions?

Thank you for the quick response!

1) Can you point out to an explanation on how to do this? "The script will require that JSL would need to be added to the script that goes through the data an makes the selections at that time".

2) If the solution above will also allow us to specify exclusions in the same data set, then speak no more. Otherwise, please point us to an explanation on how to do this: "Then the graphic script would just have to be augmented to copy the save row states from the new column to the data table row states and then run the graph"

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to save graph script with data exlusions?

Or another approach is to use a Local Data Filter as part of the graph. That way the user can easily switch from the one group to the other.

Dan Obermiller

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to save graph script with data exlusions?

Here is an example of saving and then using a row state column to reset the data table back to the state it was when the original graph was run.

```
names default to here(1);
// Open a sample data table
dt = open("$SAMPLE_DATA/big class.jmp" );
// Set some exclusions and row coloring
dt << select where(:age == 12 & :sex == "F" );
dt << hide and exclude;
dt << color by column(:age);
// Run the graph to get the results desired
Graph Builder(
Size( 522, 486 ),
Show Control Panel( 0 ),
Variables( X( :age ), Group X( :sex ), Overlay( :age ) ),
Elements( Bar( X, Legend( 8 ) ) ),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
);
// To save the data table status at the time of the graph, simply
// create a new row state column, and copy the row states to it
dt << new column("My Row States", rowstate);
dt:My Row States << copy from row states;
// To illustrate what would needed to be added to the Graph Script
// to recreate the environment it was originally run in, I will first
// clear all of the row states to bring the table back to the
// default blank row states
dt << clear row states;
// Now all that has to be done, is to copy the rowstates from the row state
// column back to the data table row states, and then rerun the graph
dt:My Row States << copy to row states;
Graph Builder(
Size( 522, 486 ),
Show Control Panel( 0 ),
Variables( X( :age ), Group X( :sex ), Overlay( :age ) ),
Elements( Bar( X, Legend( 8 ) ) ),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
);
```

I don't think this is a complete answer to your response, but I was not real sure on what else you were asking for. Could you restate what you are asking and provide more specifics?

Jim

Highlighted
I now understand that when saving a graph's script, the data selection isn't automatically saved. We'll add the exclusions manually, based on your example below. Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content