BookmarkSubscribe
Choose Language Hide Translation Bar
Newbie2Jumpie
Contributor

JMP analogy to SAS'

Hello everybody

 

I am an old SAS head (quite proficient in Base programming...). But... !

 

I'd like to do a rather simple task in JMP. So it appears ...

Basically, I would like to open the CITIES.JMP and just keep all the rows (and fields) that have a missing value in CO, and possibly save this subset under a new new, e.g. CITIES_MISS.jmp.

 

Base equivalent is "where CO is missing ;"

 

I just can't get it solved. Even if my queries appear to work, as soon as I open the subset, I find still all data rows, sometimes just marked. Please do help with sample code, and maybe explain the logical differenes between JMP and SAS logic, if there is any.

 

Thank you and Kind regards

Newbie

 

 

 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: JMP analogy to SAS'

Following up on @ian_jmp's response, he's right, this is the place to ask your questions about JMP. 

 

All the members here will be happy to help point you in the right direction. Keep asking questions and let us help you.

 

Having said that, the best way to learn JSL is to learn to use JMP interactively. Try not to make assumptions about how to do things based on the way you would do them in SAS. The two products, JMP and SAS are built with different use patterns, so they do things differently.

 

Most of the scripting language is based on automating JMP using the same commands you would use to do things interactively. For example, in your original question you wanted to know:

Basically, I would like to open the CITIES.JMP and just keep all the rows (and fields) that have a missing value in CO, and possibly save this subset under a new new, e.g. CITIES_MISS.jmp.

The way to do this interactively is to open CITIES.JMP, select all the rows where CO is missing and then use Tables->Subset to create a new data table.

 

Accordingly, the JSL do this follows the same pattern:

 

 

//open data table
dt1 = Open("$SAMPLE_DATA/Cities.jmp");

//select all rows of data table where column CO is missing
dt1 << Select Where(is Missing(:CO));

//create a subset of data table with only selected rows, keeping all columns
dt2 = dt1 << subset(selected rows(1));

//note that renaming and saving can be done in one step
dt2 << save("A new name.jmp");

 

You said:

If JMP even can't handle most simple ETL processes, we would have to go on without JMP.

Which would be a pity though, because its analytics portfolio appears to be nice and dandy.


I think most here would say that JMP can handle, simple (and complex!) ETL processes. So, if you can't figure out how to do it, just ask.

 

Here's a list of the best resources for learning JMP. 

 

Let us know as you continue to explore JMP and we'll be happy to help. 

 

[Note 20May2019: The code above has been corrected to show an assignment to dt2. Originally this was accidentally omitted. Later posts noted this and it has been corrected here.]

-Jeff
12 REPLIES 12
ian_jmp
Staff

Re: JMP analogy to SAS'

The required JSL would be something like:

NamesDefaultToHere(1);

dt1 = Open("$SAMPLE_DATA/Cities.jmp");
missingCORows = dt1 << getRowsWhere(IsMissing(:CO));
dt2 = dt1 << Subset(Rows(missingCORows));
dt2 << setName((dt << getName)||"_MISS");

Try 'Help > Books > Scripting Guide' and 'Help > Scripting Index'. Rather than think too much about comparisons, I would start with a problem and some working code that is 'close' to a solution. Experience shows you will get plenty of help here. 

Newbie2Jumpie
Contributor

Re: JMP analogy to SAS'

Thank you. Now I have the rows.
Yesterday I spent about four(!!) hours, and did not even manage to achieve
that result using Scripting Guide, JSL Syntax Reference, WWW.
So, be please be patient with me if I ask you how to also keep all the
other CTITIES fields, e.g. CITY, SO2, etc. Kind regards.
0 Kudos
dale_lehman
Community Trekker

Re: JMP analogy to SAS'

I'm sure you are looking for a script version of this and I'll leave that for someone else to provide.  Personally, I am able to do 95% of what I want without any scripting, and for me, this is one major difference between JMP and SAS (or almost any other program, for that matter).  To do what you want - without scripting - just go under Row - Row Selection - Select Where and highllight the column name CO and leave it equal to blank.  It will select the 5 rows you are looking for.  Then, under Tables, click Subset, and you will get all the columns and just those 5 rows.

 

Unfortunately, I don't think there is a way for JMP to automatically script what I just did.  If you do an analysis and go to save script, the script is automatically produced.  But I don't think there is a way to have JMP automatically script table manipulations.  I wish there was - and perhaps there is something I am not aware of.

Newbie2Jumpie
Contributor

Re: JMP analogy to SAS'

Thank you very much for your straightforward assessment

Part of my job is to evaluate JMP's strengths and limits to automate processes by scripting as a business requirement.

If JMP even can't handle most simple ETL processes, we would have to go on without JMP.

Which would be a pity though, because its analytics portfolio appears to be nice and dandy.

0 Kudos
dale_lehman
Community Trekker

Re: JMP analogy to SAS'

Of course JMP can do what you want with a script.  I am merely pointing out that what you requested can be done without one.  Anything that I do without a script has a script that is executing in the background.  The 4 hours you spent trying to get JMP to work was 4 hours trying to figure out the proper script.  I spent 5 seconds accomplishing the task without a script.  I understand - your job is to evaluate JMP and a requirement is scripting.  Well, that requirement is met.  If your concern is to evaluate the scripting language then you should wait for others to respond - there are plenty of people on this forum that can speak to JMP scripting compared with other languages.

Newbie2Jumpie
Contributor

Re: JMP analogy to SAS'

Maybe I rephrase my request to the JMP community. Can you recommend a
specific JMP forum where I could ask for a possible JMP script approach?
0 Kudos
ian_jmp
Staff

Re: JMP analogy to SAS'

I'm a liitle unclear as to the scope of what you want to do when you say 'where I could ask for a possible JMP script approach'. To what, exactly?

 

As mentioned, this is a good place to get support for all things JMP, including JSL. But, as this thread perhaps shows, it can be hard to get a clear picture - Depening on how the question is asked, responses may or may not be immediately helpful, and may or may not assume more context and prior knowledge than the questionser actually has.

 

And, as stated already 'comparisons' can be diffeicult for coding: They are even more difficult for software applications.

 

If there is a serious intent to look at how JMP can meet your needs in relation to other software (including SAS), then I know the local JMP team would be more than happy to engage and help you to figure this out.

0 Kudos
Newbie2Jumpie
Contributor

Re: JMP analogy to SAS'

Thanks a lot for your kind feedback. Maybe I made myself not clear enough.
As I happen to be more than new to JMP, I'd be more to have a pointer to
which JMP group or list I could post my question about how to filter a JMP
dataset into a subset by the "misisngs" condition. I realize now how I
worded the "subject" on my original posting, that's more than misleading.
Unfortunately, I noticed that after it was already out and too late...
0 Kudos
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: JMP analogy to SAS'

Following up on @ian_jmp's response, he's right, this is the place to ask your questions about JMP. 

 

All the members here will be happy to help point you in the right direction. Keep asking questions and let us help you.

 

Having said that, the best way to learn JSL is to learn to use JMP interactively. Try not to make assumptions about how to do things based on the way you would do them in SAS. The two products, JMP and SAS are built with different use patterns, so they do things differently.

 

Most of the scripting language is based on automating JMP using the same commands you would use to do things interactively. For example, in your original question you wanted to know:

Basically, I would like to open the CITIES.JMP and just keep all the rows (and fields) that have a missing value in CO, and possibly save this subset under a new new, e.g. CITIES_MISS.jmp.

The way to do this interactively is to open CITIES.JMP, select all the rows where CO is missing and then use Tables->Subset to create a new data table.

 

Accordingly, the JSL do this follows the same pattern:

 

 

//open data table
dt1 = Open("$SAMPLE_DATA/Cities.jmp");

//select all rows of data table where column CO is missing
dt1 << Select Where(is Missing(:CO));

//create a subset of data table with only selected rows, keeping all columns
dt2 = dt1 << subset(selected rows(1));

//note that renaming and saving can be done in one step
dt2 << save("A new name.jmp");

 

You said:

If JMP even can't handle most simple ETL processes, we would have to go on without JMP.

Which would be a pity though, because its analytics portfolio appears to be nice and dandy.


I think most here would say that JMP can handle, simple (and complex!) ETL processes. So, if you can't figure out how to do it, just ask.

 

Here's a list of the best resources for learning JMP. 

 

Let us know as you continue to explore JMP and we'll be happy to help. 

 

[Note 20May2019: The code above has been corrected to show an assignment to dt2. Originally this was accidentally omitted. Later posts noted this and it has been corrected here.]

-Jeff