cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
SpannerHead
Level VI

Rearranging Data

I have a data set that comes in from Excel whereby several key pieces of information are arranged in individual cells.  To make this data useful in JMP, I came up with a scheme to populate the data systematically in columns using lag statements.  I have some consistency in the layout which allows me to use fixed lag values.  I included an example for rearranging the data contained in the cell to the right of "Recipe".  I suspect that what I'm doing is more cumbersome than necessary if anyone has a better suggestion?

 

Before

SpannerHead_0-1748008474617.png

After

SpannerHead_1-1748008651141.png

 

	New Column("Recipe2", Character, "Nominal", Formula(If(!Is Missing(:Column 7), If(:Column 1 == "Recipe", :Column 2, Lag(:Recipe2, 1)))));
	New Column("Recipe", Character, "Nominal", Formula(If(!Is Missing(:Column 7), If(Is Missing(:"Recipe2"n), Lag(:"Recipe2"n, -4), :"Recipe2"n))));

Slán



SpannerHead
1 ACCEPTED SOLUTION

Accepted Solutions
SpannerHead
Level VI

Re: Rearranging Data

I came up with a simplification of the approach I'm already using to eliminate the need for pairs of columns.

 

	New Column("Recipe", Character, "Nominal", Formula(If(!Is Missing(:Column 7), If(Lag(:Column 1, -4) == "Recipe", Lag(:Column 2, -4), Lag(:Recipe, 1)))));

Slán



SpannerHead

View solution in original post

3 REPLIES 3
jthi
Super User

Re: Rearranging Data

Split and join/update could potentially be enough but difficult to say without seeing your data. For example from here

jthi_0-1748009217541.png

You can split your data and get clean single row which you could possibly join/update to your data

jthi_1-1748009238377.png

With multiple groups? you could add running number to the groups and use that as group in split

-Jarmo
statman
Super User

Re: Rearranging Data

My suggestions to reformat the Excel sheets you are importing in the first place.  I suggest to my clients who all use excel is to create the data table the way you want in JMP and then export it into excel to be populated.

"All models are wrong, some are useful" G.E.P. Box
SpannerHead
Level VI

Re: Rearranging Data

I came up with a simplification of the approach I'm already using to eliminate the need for pairs of columns.

 

	New Column("Recipe", Character, "Nominal", Formula(If(!Is Missing(:Column 7), If(Lag(:Column 1, -4) == "Recipe", Lag(:Column 2, -4), Lag(:Recipe, 1)))));

Slán



SpannerHead

Recommended Articles