cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Newbie2Jumpie
Level IV

How do I macro variables with JMP, e.g. like SAS macro variables (scripting, JSL)

Let's imagine we work with the JMP file "abrasion.jmp", and we would want to like to apply something like the functionality of SAS' %let macro variables.

 

In SAS I could execute WHERE clauses like ...

(1)  "where ABRASION is (&MY_ABRASION.);"

... after having specified the macro vars before like: %let MY_ABRASION=133 ; (e.g. 1st usage)

                                                                                  %let MY_ABRASION=145 ; (e.g. 2nd usage)

(2)  "where DATE eq (&MY_DATE.);"

...after having specified the macro vars before like: %let MY_DATE="29Feb1995"d; (e.g. 1st usage)

                                                                                %let MY_DATE="2May1995"d ; (e.g. 2nd usage)

(3)  or even as combination like "where DATE eq (&MY_DATE.) and ABRASION is (&MY_ABRASION.)";  ...

 

How could you do that in JMP?

Please provide practical examples.

 

Thanks a lot,

Newbie (still)

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How do I macro variables with JMP, e.g. like SAS macro variables (scripting, JSL)

Below are a couple of examples where JMP variables are used with JMP data table columns to achieve similar functionality as in your SAS MACRO examples.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

my_gender = "M";

Bivariate( Y( :height ), X( :weight ), Where( :sex == my_gender ) );

dtAirline = Open( "$SAMPLE_DATA/Aircraft Incidents.jmp" );
my_date = Informat( "01/23/2001", Date MDY( 10 ) );

dtAirline << select where( :Event Date <= my_date );

dtAirlineSubset = dtAirline << subset( selected columns( 0 ), selected rows( 1 ) );
dtAirlineSubset << run script( "Graph Builder Map" );

The best documentation for learning about the JMP Scripting Language is found in the Scripting Guide

     Help==>Books==>Scripting Guide

I strongly suggest that you take the time to read through it

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How do I macro variables with JMP, e.g. like SAS macro variables (scripting, JSL)

Below are a couple of examples where JMP variables are used with JMP data table columns to achieve similar functionality as in your SAS MACRO examples.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

my_gender = "M";

Bivariate( Y( :height ), X( :weight ), Where( :sex == my_gender ) );

dtAirline = Open( "$SAMPLE_DATA/Aircraft Incidents.jmp" );
my_date = Informat( "01/23/2001", Date MDY( 10 ) );

dtAirline << select where( :Event Date <= my_date );

dtAirlineSubset = dtAirline << subset( selected columns( 0 ), selected rows( 1 ) );
dtAirlineSubset << run script( "Graph Builder Map" );

The best documentation for learning about the JMP Scripting Language is found in the Scripting Guide

     Help==>Books==>Scripting Guide

I strongly suggest that you take the time to read through it

Jim
numerics
Level I

Re: How do I macro variables with JMP, e.g. like SAS macro variables (scripting, JSL)

To show the beauty of this feature, you can also use the actual value in a title such as we know from SAS, i.e., "&string."

 

For example:

Bivariate( Y( :height ), X( :weight ), Where( :sex == my_gender ), Title("Selection: " || my_gender ));

 

So, this allows to develop an application quite generically :) 

One has has three ways to learn: first, by reflection, that is the noblest, secondly by imitation, that is the easiest, and third, by experience, that is the bitterest.