Subscribe Bookmark RSS Feed

JSL: Populate Fit Model's "Effects" with a List of columns (some with nesting)

ABI

Community Trekker

Joined:

Jun 23, 2016

Let's say that I have the following:

colList = {"Day","Sample[Day]", "Subsample[Sample,Day]"};

 

And I would like to use this colList above to populate the Effects of a Fit Model:

myModel = Fit Model(
	Y( :Response ),
	Effects( ????? ),
	//....other stuff after this
);

 

I've tried a couple of things, and haven't had any success.

 

If I just have one column that doesn't have any nesting, and I set singleColName = colList[1], then I can get it to work by doing this:

Effects(Eval(Column(dt, singleColName)));

 

But the full list, and the nesting in particular, is causing all kinds of headaches (i.e., I've tried converting the list of column names into a list of column references, but the nesting doesn't play well with this approach).

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

When I have issues with getting the JMP functions to resolve to what I need, I will drop back to creating a literal string of exactly the code I want and then Eval(Parse()) the literal string.  Here is an example similar to what you need to do:

dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

colList = {":Lot_ID", ":lot_id[:Wafer ID in lot ID]"};

value = collist[1];
For( i = 2, i <= N Items( collist ), i++,
	value = value || "," || collist[i]
);


Eval(
	Parse(
		"myModel = Fit Model(
	Y( :PNP1 ),
	Effects( " || Value ||
		" ),
	Personality( \!"Standard Least Squares\!" )
);"
	)
);
Jim
1 REPLY
txnelson

Super User

Joined:

Jun 22, 2012

Solution

When I have issues with getting the JMP functions to resolve to what I need, I will drop back to creating a literal string of exactly the code I want and then Eval(Parse()) the literal string.  Here is an example similar to what you need to do:

dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

colList = {":Lot_ID", ":lot_id[:Wafer ID in lot ID]"};

value = collist[1];
For( i = 2, i <= N Items( collist ), i++,
	value = value || "," || collist[i]
);


Eval(
	Parse(
		"myModel = Fit Model(
	Y( :PNP1 ),
	Effects( " || Value ||
		" ),
	Personality( \!"Standard Least Squares\!" )
);"
	)
);
Jim