Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Data Table Filtering

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 18, 2017 5:09 PM
(5729 views)

Hi,

Please see next code.

dt = Open( "$sample_data/big class.jmp" );

ages = Data Table( "big class" ) << Summary( Group( :age ), Freq( "None" ), Weight( "None" ) );

sexes = Data Table( "big class" ) << Summary( Group( :sex ), Freq( "None" ), Weight( "None" ) );

For( iage = 1, iage <= N Rows( ages ), iage++,

thisAge = ages:age[iage];

For( isex = 1, isex <= N Rows( sexes ), isex++,

thisSex = sexes:sex[isex];

Eval(

Eval Expr(

gb = dt << Graph Builder(

Size( 508, 438 ),

Show Control Panel( 0 ),

Variables( X( :weight ), Y( :height ) ),

Elements( Points( X, Y, Legend( 5 ) ) ),

where( age == Expr( thisAge ) & sex == Expr( thisSex ) )

)

)

);

Please explane me purpose of Eval( Eval Expr

Thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

the line of code

`where( age == Expr( thisAge ) & sex == Expr( thisSex ) )`

has the memory variables embedded in the line.

Eval Expr(.........)

takes all of the code with in the expression

```
gb = dt << Graph Builder(
Size( 508, 438 ),
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) ),
where( age == Expr( thisAge ) & sex == Expr( thisSex ) )
)
```

and will evaluate it, which basically will mean in this case, that it will replace the variable "thisAge" and "thisSex" with their current values.

The outside Eval() then takes the results of the Eval Expr and runs that code

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Hello,

The Eval Expr() function searches its argument for Expr() functions. When it locates an Expr(), it evaluates the argument and replaces it with its value. The outer Eval() evaluates the entire expression after that evaluation and replacement occurs.

For example from your script excerpt, when iage is 1 and isex is also 1, the code that is evaluated by Eval() looks like this to JMP:

gb = dt << Graph Builder(

Size( 508, 438 ),

Show Control Panel( 0 ),

Variables( X( :weight ), Y( :height ) ),

Elements( Points( X, Y, Legend( 5 ) ) ),

where( age == 12 & sex == "F" )

)

Notice that the Where() clause above now has the variable values.

I encourage you to take a look at the article Expression Handling Functions: Part I - Unraveling the Expr(), NameExpr(), Eval(), ... Conundrum by Joseph Morgan for a much more thorough explanation.

I hope this is helpful!

Wendy

Wendy

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

the line of code

`where( age == Expr( thisAge ) & sex == Expr( thisSex ) )`

has the memory variables embedded in the line.

Eval Expr(.........)

takes all of the code with in the expression

```
gb = dt << Graph Builder(
Size( 508, 438 ),
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) ),
where( age == Expr( thisAge ) & sex == Expr( thisSex ) )
)
```

and will evaluate it, which basically will mean in this case, that it will replace the variable "thisAge" and "thisSex" with their current values.

The outside Eval() then takes the results of the Eval Expr and runs that code

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Hello,

The Eval Expr() function searches its argument for Expr() functions. When it locates an Expr(), it evaluates the argument and replaces it with its value. The outer Eval() evaluates the entire expression after that evaluation and replacement occurs.

For example from your script excerpt, when iage is 1 and isex is also 1, the code that is evaluated by Eval() looks like this to JMP:

gb = dt << Graph Builder(

Size( 508, 438 ),

Show Control Panel( 0 ),

Variables( X( :weight ), Y( :height ) ),

Elements( Points( X, Y, Legend( 5 ) ) ),

where( age == 12 & sex == "F" )

)

Notice that the Where() clause above now has the variable values.

I encourage you to take a look at the article Expression Handling Functions: Part I - Unraveling the Expr(), NameExpr(), Eval(), ... Conundrum by Joseph Morgan for a much more thorough explanation.

I hope this is helpful!

Wendy

Wendy