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

- JMP User Community
- :
- Discussions
- :
- Re: generate N 'fit y by x' charts for N unique values in column (where == uniqu...

- 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 23, 2013 1:25 PM
(7004 views)

I need to generate multiple fit y by x graphs. the number of graphs generated will vary based on the unique values in the 'RECIPE' column (used in the where clause)

**example:**

Oneway(

Y( :VALUE ),

X( :TOOL ),

Box Plots( 1 ),

X Axis Proportional( 0 ),

Grand Mean( 0 ),

Where( :RECIPE == "RecipeA" )

SendToReport(generate

etc

etc

etc

RECIPE column could contain any number of unique values ("RecipeA", "RecipeB", "Recipe67283", etc...), thus generating any number of different y by x graphs for each unique RECIPE.

when I copy the jump script, it just generates an additional block of code for each unique Where( :RECIPE == "__________") value.

**I need this script to apply to any dataset**, so i cannot specifically call out a string to match in the Where clause since these strings will vary based on the dataset!

I tried using a wildcard (?) in the Where string and that didn't work:

example

Oneway(

Y( :VALUE ),

X( :TOOL ),

Box Plots( 1 ),

X Axis Proportional( 0 ),

Grand Mean( 0 ),

Where( :RECIPE == "?" )

SendToReport(generate

etc

etc

I'm guessing the best way to accomplish this is to utilize Associative Arrays?

**If i use this code to create an array of unique RECIPES:**

uniqueRecipes = associative array(:RECIPE);

and then try to grab a specific key value, say the first one:

Oneway(

Y( :VALUE ),

X( :TOOL ),

Box Plots( 1 ),

X Axis Proportional( 0 ),

Grand Mean( 0 ),

Where( :RECIPE == uniqueRecipes <<First )

SendToReport(generate

etc

etc

the above **did not work.. **

but if i run just this line of code:

uniqueRecipes <<First

I get the correct string returned:

"RecipeA"

I am completely stumped.. maybe using associative arrays is just the wrong approach to begin with and there is an easier way? My thought was that if i could use array values in the Where clause, then i could use some sort of loop to iterate through each of the unique values in the array...

any help is **GREATLY appreciated**! thank you for your time

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

3 REPLIES 3

Highlighted

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

Highlighted
##
Re: generate N 'fit y by x' charts for N unique values in column (where == unique values from column)

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

Wow that worked! so simple, yet I was making it so complex... when i copied the script that JMP wrote by way of selecting from UI, it had used the Where( ) command and not the By( )

thank you! you just saved me hours of frustration!

Highlighted
##
Re: generate N 'fit y by x' charts for N unique values in column (where == unique values from column)

When you interactively use a platform and specify a By variable, then instead of using Script to save the script, use Script All By-Groups from the same red triangle pull down menu. Then you'll see By instead of multiple Where blocks.

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

Article Labels

There are no labels assigned to this post.