Subscribe Bookmark
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Recode Saves the Day

This blog post was written by a blogger who is no longer at SAS

Wired magazine released the results of its worldwide user survey, which asked users to self-report 3G and EDGE data speeds around the world.


The conclusion is that, when comparing various Apple-branded products, the carrier's network had more to do with data speeds than did the handsets. This sounds like an eminently interesting problem that has relevance to our daily doings. Since I'm an expert JMP user, I do data discovery just to relax at home (sweet tea, data, and exponential regression -- yum!). All I need now is the data.


And guess what? It's publicly available. Using JMP's cut and paste, getting this data into JMP takes only a few seconds. I should have this analysis done before I can finish typing up this blog post.


But, alas, were it only to be that simple. This data is self-reported, and there wasn't much control over what the user could enter as responses. For example, here's a screenshot of a few of the thousands of rows in the data table.






Look at the Carrier column and the creative ways that users entered the company AT&T: "ATT", "AT&T Wireless", "at+t", and so on. There are thousands of rows in this table. It will take me several glasses of sweet tea to go through all these rows and standardize the names of the columns.


Here enters JMP's Recode command. I want to standardize all the flavors of AT&T to have a single label. JMP's Columns > Recode command brings up a window that shows me all the occupants of a column, nicely sorted. Here's the Recode window after another few seconds worth of work, where I have the string "AT&T" on my clipboard and I rapidly descend the column of values using the down-arrow key, pasting the correct value at each step. Easy-peasy:




I do the same with the other wireless carriers, and soon I've got a nice standardized list to analyze. The other self-reported columns can be put in analysis shape with the same command, and soon the analysis is underway -- an analysis, you should note, that I leave as an exercise to the reader. You've got the data, after all.

4 Comments
Community Member

Hector Lavalle wrote:

Hello,

Is there a way you can see or call the exact recode jsl script that JMP uses? I need it, in order to build a Journal and automatize Recoding option as a journal

Regards

- Hector Lavalle

Community Member

Daniel wrote:

Thanks Xan!

Community Member

Xan Gregg wrote:

With scripting you can loop through the rows and change values as you like. For example.

For Each Row( If ( Starts With( :carrier, "AT" ), :carrier = "AT&T" ));

or to get what I think you're after:

For Each Row( If( Is Missing(:value), :value = 0 ));

If you want to reuse a particular Recode operation in a script, choose "Formula Column" as the output and use the formula as is or in a For Each Row() function.

Community Member

Daniel wrote:

Is there any way to script a recode in JSL, or do you have to do it by hand each time? I'd like to find a quick way to recode null values with zeros in some of my columns.

Article Tags