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
Level IV

Different results for same script



I´ve created a script where I create a variable for later calculations and I´ve run into two things I cannot explain:


1) On several occasions I´ve seen that running the script twice doesn´t provide the same result. As you can see the first result is a mean of the entire column whereas the second is a single value (the one I need).

2) I´ve also seen that suddenly jmp can´t seem to find the column I´m referring to ("Mean(VO2_M)") even though it has worked fine 5 minutes earlier. If I then copy paste the exact same column name in it´s place it works again. Even though there is no difference at all.


My script:

1st run:
VarVehicleVo2 = :Name( "Mean(VO2_M)" )[Data Table( "GroupAvg" ) << Get rows Where( Contains( :Treatment, "ehicle" ))]; /*: (result from log) [14.9924786986111]
VarVehicleVo2 = :Name( "Mean(VO2_M)" )[Data Table( "GroupAvg" ) << Get rows Where( Contains( :Treatment, "ehicle" ))]; /*: (result from log) [10.8838853430556]

I´ve seen this quite a few times now so I´m guessing I must be missing something?


Br Julie


Super User

Re: Different results for same script

  1. Are you using
    Names Default to Here( 1 );
    to isolate this script from other scripts that may have previously run during your JMP session?
  2. Do you have a Name Space called "1st Run"
    1st run:VarVehicleVo2
    This syntax with the ":" in it indicates that a Name Space or Data Table is available in your JMP session
  3. You are referencing a non specific data table for your "Mean(Vo2_M)" column
    :Name( "Mean(VO2_M)" )
    This form of referencing of your column will look in the Current Data Table (I.e. the last one created, or the last one purposefully clicked on or unintentionally clicked on).  You should change the reference to make sure it is pointing to the correct data table
    dt = Data Table("name of data table");
    dt:Name( "Mean(VO2_M)" )

I suspect one or more of these issues are causing your probilem

Level IV

Re: Different results for same script

Thanks for the response @txnelson .


The 1st run wording isn´t in the script I just tried to describe the order of the runs but I see now that it was very confusing. Sorry about that.


I do have

Names Default to Here( 1 );

at the top of my script without any effect but after adding it to just before the specific part described it actually worked.

However, I actually assumed that I did reference the table: 

VarVehicleVo2 = :Name( "Mean(VO2_M)" )[Data Table( "GroupAvg" ) <<
Get rows Where( Contains( :Treatment, "ehicle" ))];

in the first line:

Data Table( "GroupAvg" ) <<


Why is that not enough?

Br Julie

Article Labels

    There are no labels assigned to this post.