World Statistics Day was yesterday, but we’re celebrating all week long! This celebration means acknowledging the impact statistics has on our world. Who is your favorite statistician? Share with us who they are and why they top your favorites list.
Choose Language Hide Translation Bar
Highlighted

## Populating the data in new table with variable defined in script

Hi all,

Actually i am trying to perform a calculation in jmp script, i have defined these calculation using a variable. ( ie- a,b etc), now i trying to populate this variable into a new table, such that each time if input changes , calculation will change and new data will be populated in new table.

let us assume a= weibull function( consider every input i have for calculating a)

``````dt = New Table( "Result",
New Column( "X",
Expression,
"Nominal",
Set Values( {a} )
)
);``````

in new table i am getting output as a, not the value of a. i want value of a to be populated.

Thanks,

Dilip

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted  Ryan_Gilmore Community Manager

## Re: Populating the data in new table with variable defined in script

I think you may need to add some rows the table.

``````dt = New Table( "Result" );

// Method for inserting a function
b = Expr(
Random Uniform( 1, 10 )
);
dt << New Column( "Y", continuous, "nominal", formula( Name Expr( b ) ) );

dt << add row( 5 );
``````

In the first example, setting the values of column X automatically generated the rows.

3 REPLIES 3
Highlighted  Ryan_Gilmore Community Manager

## Re: Populating the data in new table with variable defined in script

Hi @dilipkumar ,

Not knowing what the variables (a, b, etc.) might contain, here are two examples if the variables contain a list or a function, that will populate the column with the values defined by the variable and not the variable itself,

``````dt = New Table( "Result" );

// Method for inserting a list or a matrix
a = [1, 2, 3, 4];
dt << New Column( "X", Continuous, "Nominal", Set Values( a ) );

// Method for inserting a function
b = Expr(
Random Uniform( 1, 10 )
);
dt << New Column( "Y", continuous, "nominal", formula( Name Expr( b ) ) );``````

Hope that helps.

Highlighted

## Re: Populating the data in new table with variable defined in script

My variable is function, it return some values,
i tried using your second example, i am getting empty data table named " Result"
Highlighted  Ryan_Gilmore Community Manager

## Re: Populating the data in new table with variable defined in script

I think you may need to add some rows the table.

``````dt = New Table( "Result" );

// Method for inserting a function
b = Expr(
Random Uniform( 1, 10 )
);
dt << New Column( "Y", continuous, "nominal", formula( Name Expr( b ) ) );

dt << add row( 5 );
``````

In the first example, setting the values of column X automatically generated the rows.

Article Labels

There are no labels assigned to this post.