<?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 Re: How to replace Missing Values w/ '0' using JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4978#M4977</link>
    <description>&lt;P&gt;This is essentially the same as exj's response but a little cleaner.&amp;nbsp; It does; however, only change missing in Numeric columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();
for(ij = 1, ij &amp;lt;= NCol(dt), ij +=1,
                CurCol = Column(dt, ij);
                If(CurCol &amp;lt;&amp;lt; get data type == "Numeric",
                                For Each Row(
                                                IF(IsMissing(CurCol[]), CurCol[] = 0)
                                );
                );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jun 2018 15:09:56 GMT</pubDate>
    <dc:creator>jpkim</dc:creator>
    <dc:date>2018-06-13T15:09:56Z</dc:date>
    <item>
      <title>How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4975#M4974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do I replace Missing Values w/ '0' using JSL?&lt;/P&gt;&lt;P&gt;I can do this manually using 'Find and Replace All', but I need to incorporate it in a code that runs automatically everyday.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 May 2012 06:51:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4975#M4974</guid>
      <dc:creator>ambs</dc:creator>
      <dc:date>2012-05-28T06:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4976#M4975</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is based on book 'Jump into scripting'. I replace all the missing values with z.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;allCols = dt2 &amp;lt;&amp;lt; Get Column Names( String );
For( i = 1, i &amp;lt;= N Items( allCols ), i++,
/* Loop through each row. */
For( j = 1, j &amp;lt;= N Rows( dt2 ), j++,
/* The IsMissing function will return a ‘1’ or true if the
value is missing. If true, cell is assigned zero. */
  If( Is Missing( Column( dt2, allCols ) ),
   Column( dt2, allCols ) = "z"
  )
)
);&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;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 15:08:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4976#M4975</guid>
      <dc:creator>exj</dc:creator>
      <dc:date>2018-06-13T15:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4977#M4976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would avoid using j as a looping variable because it is also a JSL function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 class="synobj"&gt;&lt;A name="2680657"&gt;&lt;/A&gt;J(nrows, &amp;lt;ncols&amp;gt;, &amp;lt;value&amp;gt;)&lt;/H2&gt;&lt;P class="defterm"&gt;&lt;A name="2680658"&gt;&lt;/A&gt; &lt;/P&gt;&lt;P class="defterm"&gt;Function: &lt;A name="2680659"&gt;&lt;/A&gt;Creates a matrix of identical values. &lt;/P&gt;&lt;P class="defterm"&gt;&lt;A name="2680660"&gt;&lt;/A&gt;Returns: &lt;A name="2680661"&gt;&lt;/A&gt;The matrix.&lt;/P&gt;&lt;P class="defterm"&gt;&lt;A name="2680662"&gt;&lt;/A&gt;Arguments:&lt;/P&gt;&lt;P class="defterm"&gt;&lt;A name="2680663"&gt;&lt;/A&gt;nrows: &lt;A name="2680664"&gt;&lt;/A&gt;Number of rows in matrix. If &lt;CODE&gt;ncols&lt;/CODE&gt; is not specified, &lt;CODE&gt;nrows&lt;/CODE&gt; is also used as &lt;CODE&gt;ncols&lt;/CODE&gt;.&lt;/P&gt;&lt;P class="defterm"&gt;&lt;A name="2680665"&gt;&lt;/A&gt;ncols: &lt;A name="2680666"&gt;&lt;/A&gt;Number of columns in matrix.&lt;/P&gt;&lt;P class="defterm"&gt;&lt;A name="2680667"&gt;&lt;/A&gt;value: &lt;A name="2680668"&gt;&lt;/A&gt;The value used to populate the matrix. If &lt;CODE&gt;value&lt;/CODE&gt; is not specified, 1 is used.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 12:31:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4977#M4976</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2012-05-29T12:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4978#M4977</link>
      <description>&lt;P&gt;This is essentially the same as exj's response but a little cleaner.&amp;nbsp; It does; however, only change missing in Numeric columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();
for(ij = 1, ij &amp;lt;= NCol(dt), ij +=1,
                CurCol = Column(dt, ij);
                If(CurCol &amp;lt;&amp;lt; get data type == "Numeric",
                                For Each Row(
                                                IF(IsMissing(CurCol[]), CurCol[] = 0)
                                );
                );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 15:09:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4978#M4977</guid>
      <dc:creator>jpkim</dc:creator>
      <dc:date>2018-06-13T15:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4979#M4978</link>
      <description>&lt;P&gt;Yet another way to do it but with a single loop (Numeric columns only).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #2600eb;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
nc = dt &amp;lt;&amp;lt; get column names( Numeric );
For( i = 1, i &amp;lt;= N Items( nc ), i++,
  nc[i][dt &amp;lt;&amp;lt; get rows where( Is Missing( nc[i][] ) )] = 0
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 15:07:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4979#M4978</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2018-06-13T15:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4980#M4979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks everone!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Jun 2012 01:55:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4980#M4979</guid>
      <dc:creator>ambs</dc:creator>
      <dc:date>2012-06-02T01:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4981#M4980</link>
      <description>&lt;P&gt;Another way...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;clsMat = dt &amp;lt;&amp;lt; Get As Matrix( {"colA", "colB"} );

clsMat[Loc( Is Missing( clsMat ) )] = 0;

:colA &amp;lt;&amp;lt; Set Values( clsRej[0, 1] );
:colB &amp;lt;&amp;lt; Set Values( clsRej[0, 2] );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;logical indexing is often faster than loops&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 12:54:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4981#M4980</guid>
      <dc:creator>jkwiggins</dc:creator>
      <dc:date>2019-08-12T12:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4982#M4981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;cool! &lt;SPAN style="font-size: 10pt;"&gt;... in the last 2 lines, clsRej should be replaced to clsMat, right?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;meanwhile, do we have any similar solutions for character column?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 21:04:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4982#M4981</guid>
      <dc:creator>masakit</dc:creator>
      <dc:date>2016-07-14T21:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4983#M4982</link>
      <description>&lt;P&gt;Since no one else answered, the solution is the same, just grab character columns instead and set the rows equal to the character you find fitting--"N/A" in the below case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just be careful, setting it =0 will change the column to numeric and will remove all the character data, however ="0" should be fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
nc = dt &amp;lt;&amp;lt; get column names( Character );

For( i = 1, i &amp;lt;= N Items( nc ), i++,
&amp;nbsp; nc[i][dt &amp;lt;&amp;lt; get rows where( Is Missing( nc[i][] ) )] = "N/A"
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 12:55:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4983#M4982</guid>
      <dc:creator>msharp</dc:creator>
      <dc:date>2019-08-12T12:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4984#M4983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry to be late to this party, but I feel compelled to interject: Setting missing values to zero (or the mean or any other single imputation method) has serious drawbacks.&amp;nbsp; Most of these approaches produce biased parameter estimates, even in ideal conditions where the data are Missing Completely At Random.&amp;nbsp; There are much better ways to deal with missing data.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2016 22:08:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4984#M4983</guid>
      <dc:creator>Kevin_Anderson</dc:creator>
      <dc:date>2016-07-22T22:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4985#M4984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While what you say is true, it makes assumptions about the data.&amp;nbsp; For example, maybe his data isn't continuous?&amp;nbsp; Sometimes 0 isn't recorded and instead left as missing.&amp;nbsp; If someone were to try and do a Oneway analysis using 0 as false and 1 as true &lt;SPAN style="font-size: 13.3333px; line-height: 20px;"&gt;they'd have a problem if their zero's ended up displaying as missing&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;, since Oneway analysis ignores missing rows in JMP.&amp;nbsp; They'd end up with ONLY ONE category! &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are other reasons 0 could show up as missing.&amp;nbsp; Usually storing 0 in a large database is a waste of space.&amp;nbsp; Since Pokemon Go is big right now, I'll use it as an example.&amp;nbsp; I might want to record all the pokemon I caught in a day, 12 ratattas and 6 pidgeys.&amp;nbsp; I wouldn't however, want to then store 0 for the other 148 pokemon I didn't catch that day.&amp;nbsp; If I did I'd quickly fill up my database with useless information.&amp;nbsp; Thus, if I queried my data I'd get missing for most of my pokemon at any given time, but missing is = to 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In similar situations you could get missing data that are equivalent to 0 b/c of data conversion issues, poorly designed queries, ect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2016 22:25:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4985#M4984</guid>
      <dc:creator>msharp</dc:creator>
      <dc:date>2016-07-22T22:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4986#M4985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's all true.&amp;nbsp; I felt like it was time to put up a Caution flag.&amp;nbsp; Just because we &lt;EM&gt;can&lt;/EM&gt; do something in JMP doesn't always mean we &lt;EM&gt;should&lt;/EM&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2016 22:37:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4986#M4985</guid>
      <dc:creator>Kevin_Anderson</dc:creator>
      <dc:date>2016-07-22T22:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4987#M4986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Absolutely, I appreciate the word of caution.&amp;nbsp; I for sure, didn't think about it.&amp;nbsp; &lt;/P&gt;&lt;P&gt;It's also important to remember that missing data can be valuable data, and sometimes it's best to leave it as is!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2016 23:13:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/4987#M4986</guid>
      <dc:creator>msharp</dc:creator>
      <dc:date>2016-07-22T23:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace Missing Values w/ '0' using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/221295#M44172</link>
      <description>&lt;P&gt;This works when I am running it from a scripting window using play button, but not within a debugger or launching it by autorun of the .jsl.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtLongestWaitStates &amp;lt;&amp;lt; set name( "LongestWaitStates" );
dtLongestWaitStates = Current Data Table();
nc = dtLongestWaitStates &amp;lt;&amp;lt; get column names( numeric );
For( i = 1, i &amp;lt;= N Items( nc ), i++,
	nc[i][dtLongestWaitStates &amp;lt;&amp;lt; get rows where( Is Missing( nc[i][] ) )] = 0
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RaginCajun&lt;/P&gt;
&lt;P&gt;JMP13.2.1&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 12:52:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-Missing-Values-w-0-using-JSL/m-p/221295#M44172</guid>
      <dc:creator>RaginCajun</dc:creator>
      <dc:date>2019-08-12T12:52:01Z</dc:date>
    </item>
  </channel>
</rss>

