Hi All,
Having trouble with the proper referencing of a column when passing the command <<Simulate to a report window using JSL.
The section of code I'm having a hard time with is the following:
report_of_interest[Number Col Box( 8 )] << Simulate(
NBSnum,
Random Seed( RSnum ),
Out( Eval( YCols ) ),
In( :Simulated Y )
);
Running that section of code gives the following error: Column to switch out not found. and then pops up the window where you're supposed to select the columns to switch in and out.
The report_of_interest is the report window where I'm sending the Simulate command. Specifically to the NumberColBox(8), which is the Estimate column in the report. NBSnum and RSnum are the number of bootstrap samples to run and a random seed variable. The problem is the name of the column in the Out( ) of the Simulate( ) command. The In( ) column is no problem because I can name the simulated data column whatever I want, but the column for the Out( ) option is not a column I really want to rename or anything. In this case, I save the simulated data to the data table and rename the column to "Simulated Y" so I can reference it as is needed in the Simulate command as In(:Simulated Y).
Earlier in the code, the user is prompted to select the column that will be the response column for modeling, this is YCols, and often, when dealing with a column in a platform, you can just have it as Eval(YCols), and it accepts it just fine, for example:
fm = avdt << Fit Model(
Y( Eval( YCols ) ),
Validation( :Validation ),
Effects( :Null Factor, Eval( XCols ) ),
Personality( "Generalized Regression" ),
Run( Fit( Estimation Method( Forward Selection ), Validation Method( Validation Column ) ) )
);
Will run a fit model on the Y( ) column correctly. However, the Simulate( ) command wants to have the column referenced as a scoped column, I believe, as it wants it to be, :My Column To Model, for example.
Let's say that the column has the name "My Column To Model", so the variable YCols and Eval(YCols) will both return the following {"My Column To Model"}. When sending the simulate command to the report, it wants the scoped column name, like the following:
report_of_interest[Number Col Box( 8 )] << Simulate(
NBSnum,
Random Seed( RSnum ),
Out( :My Column To Model ),
In( :Simulated Y )
);
The problem is, the column I'm modeling can change, therefore it's name changes, and I don't want to rename the column to always be a fixed name like :YData. I want to work with a variable like YCols, but I don't know how to work with the infix colon operator (:) and a variable like YCols to have the correct column reference for the Simulate( ) command.
I've tried As Column(dt, name), Column(dt, name), Column(number), Parse(":"||char(Column(avdt, Eval(YCols)))), Parse(":"||Eval(YCols)[1]), and none of those work. They all result in the same error mentioned above and open up a new window to select the columns to swap In/Out, which negates the automation I'm trying to do.
Any help is much appreciated.
Thanks!,
DS