Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
nrodrig1
Level III

Go to next i

Hi-

I have a dataset that has many "Supplier_part_number" combinations. I want to make a new table for each subset of these combinations. I want to only make one for each "Supplier_part_number" combination so i created a "FLAG_keep" column which is just an if statement that says if "Supplier_part_number" ==Lag("Supplier_part_number" ,1) then "FLAG_keep"=1 otherwise it equals 0 . Gives me a table for i=1. Then seems to just stop. i=2 and 3 have :FLAG_keep[i] ==1 so i expect not to get anything. but then i=4 has :FLAG_keep[i] ==0 and i don't get anything.

 

I tried mimicking the work here https://community.jmp.com/t5/Discussions/Break-Continue-a-nested-outer-for-loop/td-p/8885 but still seem to be doing something wrong. Grateful for any help. Thanks!

 

dt= data table("master_dataset for regressions");
for(i=1,i<=10,i++,
	if(:FLAG_keep[i] ==1, Break());
		dt<<Select Where( :Supplier_part_number ==:Supplier_part_number[i]);
		part_of_interest_1 = :Supplier_part_number[i];
		selRows = N row( dt << Get Selected Rows );
		dtsub = dt << Subset( output table name("JoinedSubset"|| char(i)));
);
w= new window("done");
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
ron_horne
Super User

Re: Go to next i

Hi @nrodrig1 

If the goal is to produce a separate regression (or any other graph or analysis) the best thing would be to keep the table in once piece and use the By option in each platform. this would produce separate outputs for each By group (make sure the variable you put in the By is ordinal or nominal).

https://youtu.be/pXI9YSOEggs?t=86 

one you do that, you can also use the "make combined data table" to summarize your output neatly.

https://youtu.be/mxmbGr_y8_Y?t=50 

 

let us know if this helps

ron

 

View solution in original post

JMP brings a radically different approach to the daily task of slicing and dicing data. Here's a look at some of the grouping and filtering capabilities in J...
9 REPLIES 9
Highlighted
nrodrig1
Level III

Re: Go to next i

I changed break to continue

if(:FLAG_keep[i] ==1, continue());

now it skips the first two cases where :FLAG_keep[i] ==1 but then makes tables for each other row regardless of what :FLAG_keep[i] value is. Getting closer but I think there is some conceptual or logic that is key and i'm not getting.

Highlighted
vince_faller
Super User

Re: Go to next i

Would subset by work for you?

 

Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
dt << Subset(
	By( :age ),
	All rows,
	Selected columns only( 0 )
);
Vince Faller - Predictum
Highlighted
nrodrig1
Level III

Re: Go to next i

Not sure i follow. i want a single table for each subset based on supplier_part number combination.

 

I will ultimately need to do regressions for each set within these supplier_part number combinations. My plan is to make table for each and within the table run a regression then use the some values from the regression output to map back to my main table. There might be a simpler way to do that and i'm open to suggestions. I can post table if you think that would help visualize?


Highlighted
ron_horne
Super User

Re: Go to next i

Hi @nrodrig1 

If the goal is to produce a separate regression (or any other graph or analysis) the best thing would be to keep the table in once piece and use the By option in each platform. this would produce separate outputs for each By group (make sure the variable you put in the By is ordinal or nominal).

https://youtu.be/pXI9YSOEggs?t=86 

one you do that, you can also use the "make combined data table" to summarize your output neatly.

https://youtu.be/mxmbGr_y8_Y?t=50 

 

let us know if this helps

ron

 

View solution in original post

JMP brings a radically different approach to the daily task of slicing and dicing data. Here's a look at some of the grouping and filtering capabilities in J...
Highlighted
nrodrig1
Level III

Re: Go to next i

Wow this is great!

This has me much farther along but now brings me to another question which might have to do with the computing power or old jmp 12 version i have.

 

 Fit Y by X isn't giving me the coefficients and R-Square statistics. Looks like i have to go through 'Fit Model' and that seems to have more bells and whistles to it. When i try to run the report with 300,000 rows approx 20,000 group by's it freezes. I can break it up into smaller groups - still a much faster way than what i was doing before. But just in case do you have any suggestions about the most efficient option to run 20,000 two indep var regressions?

 

 

Highlighted
txnelson
Super User

Re: Go to next i

I am not sure what coefficients you are looking for.  Below is an output from a Fit Y by X, with Fit Line having been specified, and it has the reqression coefficients

estimates.PNG

Jim
Highlighted
nrodrig1
Level III

Re: Go to next i

Hi, yes, that's the sort of output i'm looking for. However, I only see charts (bottom left screen shot). I apologize if i'm overlooking something very simple but i'm not seeing any way to pull up the regression  r squared, y intercept or x coefficients. below are a couple of screen shots of my input and output. Is there something in the input screen i'm not selecting? In the output i've been clicking on down red triangles and right clicking my cursor all over the place but i can't seem to find anything that leads me to those diagnostics. Thanks!

Fit Y by X output 20191030.PNGFit Y by X input 20191030.PNG

Highlighted
ron_horne
Super User

Re: Go to next i

Hi @nrodrig1 

from the output you have

click CTRL and left mouse button on the red triangle of one of the plots. there, select "fit line" as in the picture.

Untitled.png

Highlighted
nrodrig1
Level III

Re: Go to next i

Thank you!!
Article Labels

    There are no labels assigned to this post.