<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to work with datasets that are structured by rows and columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-work-with-datasets-that-are-structured-by-rows-and/m-p/616581#M81623</link>
    <description>&lt;P&gt;Hello jmp community,&lt;/P&gt;&lt;P&gt;i am a relative beginner in JMP and analytics in general and am getting to my limits in working with datasets that don't have a common structure. I am not sure how data like that is actually called, which makes it hard for me to describe it in words. Basically, there is e.g. a column for every year and rows are not just single observations of a person or similar, but a more complex, hierarchical structure for the rows. (Example files are in the attachment, so you know what i mean) In any case, this structure makes it near impossible for me to make meaningfol reports. Is there a general way to approach working with such data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!&lt;/P&gt;</description>
    <pubDate>Sun, 11 Jun 2023 11:30:51 GMT</pubDate>
    <dc:creator>lebTHI</dc:creator>
    <dc:date>2023-06-11T11:30:51Z</dc:date>
    <item>
      <title>How to work with datasets that are structured by rows and columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-work-with-datasets-that-are-structured-by-rows-and/m-p/616581#M81623</link>
      <description>&lt;P&gt;Hello jmp community,&lt;/P&gt;&lt;P&gt;i am a relative beginner in JMP and analytics in general and am getting to my limits in working with datasets that don't have a common structure. I am not sure how data like that is actually called, which makes it hard for me to describe it in words. Basically, there is e.g. a column for every year and rows are not just single observations of a person or similar, but a more complex, hierarchical structure for the rows. (Example files are in the attachment, so you know what i mean) In any case, this structure makes it near impossible for me to make meaningfol reports. Is there a general way to approach working with such data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:30:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-work-with-datasets-that-are-structured-by-rows-and/m-p/616581#M81623</guid>
      <dc:creator>lebTHI</dc:creator>
      <dc:date>2023-06-11T11:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to work with datasets that are structured by rows and columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-work-with-datasets-that-are-structured-by-rows-and/m-p/616610#M81626</link>
      <description>&lt;P&gt;Welcome to the community.&lt;/P&gt;
&lt;P&gt;Your data is easily entered into JMP, with the Excel Wizard, to guide you through.&lt;/P&gt;
&lt;P&gt;Typically the analytical format of the data is laid out vertically, not horizontally.&amp;nbsp; Therefore stacking all of your year data is how I would typically start.&lt;/P&gt;
&lt;P&gt;I have provided a couple of scripts that I put together that read in the 2 spreadsheets you provided.&amp;nbsp; In both cases, I input and transformed the data using interactive JMP, and then took from JMP, the scripts it produced to do the actual work, and saved them into the scripts below.&lt;/P&gt;
&lt;P&gt;For the Verkehrsunfalle data&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1679806783704.png" style="width: 792px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51479i0144BAC7CAAD36CC/image-dimensions/792x281?v=v2" width="792" height="281" role="button" title="txnelson_0-1679806783704.png" alt="txnelson_0-1679806783704.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1679806895279.png" style="width: 437px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51480i9416CD0AE29E3DA6/image-dimensions/437x480?v=v2" width="437" height="480" role="button" title="txnelson_0-1679806895279.png" alt="txnelson_0-1679806895279.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open(
	"path to your data",
	Worksheets( "46241-0022" ),
	Use for all sheets( 1 ),
	Concatenate Worksheets( 0 ),
	Create Concatenation Column( 0 ),
	Worksheet Settings(
		1,
		Has Column Headers( 1 ),
		Number of Rows in Headers( 1 ),
		Headers Start on Row( 4 ),
		Data Starts on Row( 5 ),
		Data Starts on Column( 1 ),
		Data Ends on Row( 0 ),
		Data Ends on Column( 0 ),
		Replicated Spanned Rows( 1 ),
		Replicated Spanned Headers( 0 ),
		Suppress Hidden Rows( 1 ),
		Suppress Hidden Columns( 1 ),
		Suppress Empty Columns( 1 ),
		Treat as Hierarchy( 0 ),
		Multiple Series Stack( 0 ),
		Import Cell Colors( 0 ),
		Limit Column Detect( 0 ),
		Column Separator String( "-" )
	)
);

// Fill in rows where repeating values have been deleted
For( i = 1, i &amp;lt;= 2, i++,
	For( k = 1, k &amp;lt;= N Rows( dt ), k++,
		If( Column( i )[k] != "",
			hold = Column( i )[k]
		);
	
		Column( i )[k] = hold;
		
	)
);

// Get rid of dashes being used as an indicator of blank data
// Also, change columns to numeric after the dashes are changed
for(i=4,i&amp;lt;=ncols(dt),i++,
	try(as column(i)[dt&amp;lt;&amp;lt;get rows where(as column(i)=="-")] = "");
	column(i)&amp;lt;&amp;lt;data type(numeric)&amp;lt;&amp;lt;modeling type(continuous);
);

// Stack all of the Years data
dtStack = dt &amp;lt;&amp;lt; Stack(
	columns( :"1995"n, :"1996"n, :"1997"n, :"1998"n, :"1999"n, :"2000"n, :"2001"n ),
	Source Label Column( "Jahr" ),
	Stacked Data Column( "Straßenverkehrsunfälle" ),
	"Non-stacked columns"n(
		Keep(
			:BundesländerStraßenklasseOrtslage, :BundesländerStraßenklasseOrtslage 2,
			:BundesländerStraßenklasseOrtslage 3
		)
	),
	Output Table( "Final" )
);

// Change the Jahr column to numeric, ordinal
dtStack:Jahr &amp;lt;&amp;lt; data type(numeric)&amp;lt;&amp;lt;modeling type(ordinal);

// Change column names to meaningful names
column(dtStack, 1) &amp;lt;&amp;lt; set name("Bundeslander");
column(dtStack, 2) &amp;lt;&amp;lt; set name("Straßenklasse");
column(dtStack, 3) &amp;lt;&amp;lt; set name("Ortslage");

// Entfernen Sie die Kategorie "Insgesamt"
dtStack &amp;lt;&amp;lt; select where( :Ortslage == "Insgesamt" );
dtStack &amp;lt;&amp;lt; delete rows;
dtStack &amp;lt;&amp;lt; select where( :Straßenklasse == "Insgesamt" );
dtStack &amp;lt;&amp;lt; delete rows;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the Eurostat data&lt;/P&gt;
&lt;P&gt;Again entered into JMP using the Excel Wizard, and then stacking the data&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_1-1679807087962.png" style="width: 847px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51481iF4933E11E834A7E0/image-dimensions/847x305?v=v2" width="847" height="305" role="button" title="txnelson_1-1679807087962.png" alt="txnelson_1-1679807087962.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1679807199387.png" style="width: 491px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51482iDE3A6F5EBC726695/image-dimensions/491x709?v=v2" width="491" height="709" role="button" title="txnelson_0-1679807199387.png" alt="txnelson_0-1679807199387.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = // Import Excel file: lebTHI_EurostatTable.xls
// → Data Table( "Sheet0" )
Open(
	"path to your data",
	Worksheets( "Sheet0" ),
	Use for all sheets( 1 ),
	Concatenate Worksheets( 0 ),
	Create Concatenation Column( 0 ),
	Worksheet Settings(
		1,
		Has Column Headers( 1 ),
		Number of Rows in Headers( 1 ),
		Headers Start on Row( 3 ),
		Data Starts on Row( 4 ),
		Data Starts on Column( 1 ),
		Data Ends on Row( 0 ),
		Data Ends on Column( 0 ),
		Replicated Spanned Rows( 1 ),
		Replicated Spanned Headers( 0 ),
		Suppress Hidden Rows( 1 ),
		Suppress Hidden Columns( 1 ),
		Suppress Empty Columns( 1 ),
		Treat as Hierarchy( 0 ),
		Multiple Series Stack( 0 ),
		Import Cell Colors( 0 ),
		Limit Column Detect( 0 ),
		Column Separator String( "-" )
	)
);

// delete rows where footnotes were input
dt &amp;lt;&amp;lt; select where(:"1997"n =="");
dt &amp;lt;&amp;lt; delete rows;

// Stack all of the year data
dtStack = dt &amp;lt;&amp;lt; Stack(
	columns(
		:"1990"n, :"1991"n, :"1992"n, :"1993"n, :"1994"n, :"1995"n, :"1996"n,
		:"1997"n, :"1998"n, :"1999"n, :"2000"n, :"2001"n, :"2002"n, :"2003"n,
		:"2004"n, :"2005"n, :"2006"n, :"2007"n, :"2008"n, :"2009"n, :"2010"n,
		:"2011"n, :"2012"n, :"2013"n, :"2014"n, :"2015"n
	),
	Source Label Column( "Jahr" ),
	Stacked Data Column( "Arbeitslosenquote" ),
	"Non-stacked columns"n( Keep( :geo\time ) ),
	Output Table( "Stacked Unemployment " )
);

// Change : to blanks
dtStack:Arbeitslosenquote[dtStack &amp;lt;&amp;lt; get rows where(:Arbeitslosenquote == ":")] = "";

// Change Arbeitslosenquote to numeric, continuous
dtStack:Arbeitslosenquote &amp;lt;&amp;lt; datatype(numeric)&amp;lt;&amp;lt;modelingtype(continuous);

// Convert to JMP percent value and change display format
for each row( :Arbeitslosenquote = :Arbeitslosenquote/100);
dtStack:Arbeitslosenquote&amp;lt;&amp;lt;format("Percent", 7,2);

// Change Jahr to numeric, ordinal
dtStack:Jahr &amp;lt;&amp;lt; datatype(numeric)&amp;lt;&amp;lt;modelingtype(ordinal);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2023 05:07:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-work-with-datasets-that-are-structured-by-rows-and/m-p/616610#M81626</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-03-26T05:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to work with datasets that are structured by rows and columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-work-with-datasets-that-are-structured-by-rows-and/m-p/616622#M81627</link>
      <description>&lt;P&gt;Nice! Thanks for showing a general approach for converting the human-friendly representation into a computer-friendly format. I particularly liked&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;Entfernen Sie die Kategorie "Insgesamt"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;at the end of the first one. Maybe there was a formula to calculate those totals at some point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2023 12:56:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-work-with-datasets-that-are-structured-by-rows-and/m-p/616622#M81627</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-03-26T12:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to work with datasets that are structured by rows and columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-work-with-datasets-that-are-structured-by-rows-and/m-p/616656#M81630</link>
      <description>&lt;P&gt;Hello, thanks a lot for taking the time for such a good answer! I will try it myself soon when I get around to it, following to your guide, and let you know how it went. :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2023 17:40:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-work-with-datasets-that-are-structured-by-rows-and/m-p/616656#M81630</guid>
      <dc:creator>lebTHI</dc:creator>
      <dc:date>2023-03-26T17:40:51Z</dc:date>
    </item>
  </channel>
</rss>

