<?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: Select Where on Dates in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53807#M30395</link>
    <description>&lt;P&gt;Yes, that isn't working. Is it possible that my :Date values are not the same as my JMP calendar box() values?&lt;/P&gt;
&lt;P&gt;This is how I cam calculating :Date&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt&amp;lt;&amp;lt; new column ("Date", numeric, continuous, format("m/d/y"), formula(
Date MDY(
Num( Substr( :TimeStamp, 1, 2 ) ),
Num( Substr( :TimeStamp, 4, 2 ) ),
Num( Substr( :TimeStamp, 7, 4 ) ) )
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;:TimeStamp are characters in the format&amp;nbsp;01:28:2018::02:14:08:099&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;StartDate and EndDate are from this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;new window("Start Date of Data",&amp;lt;&amp;lt;Modal, StartDate = Calendar Box());
Show( Short Date( StartDate &amp;lt;&amp;lt; Get Date ) );
new window("End Date of Data",&amp;lt;&amp;lt;Modal, EndDate = Calendar Box());
Show( Short Date( EndDate &amp;lt;&amp;lt; Get Date ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 26 Mar 2018 14:00:52 GMT</pubDate>
    <dc:creator>KST-CPT</dc:creator>
    <dc:date>2018-03-26T14:00:52Z</dc:date>
    <item>
      <title>Select Where on Dates</title>
      <link>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53805#M30393</link>
      <description>&lt;P&gt;I am trying to create a subset of a data set.&amp;nbsp; I want to select the dates outside of my start and end dates for analysis, then exclude such dates.&amp;nbsp; Not sure why this is not working, seems easy.&amp;nbsp; I think it is number format issues?&lt;/P&gt;
&lt;P&gt;I have StartDate and EndDate as dates from CalendarBox()&lt;/P&gt;
&lt;P&gt;:Date is a column with numeric dates&amp;nbsp;in format m/d/y.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried this to no success:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;BegTime = dt&amp;lt;&amp;lt; Subset(All rows, Selected columns only( 0 ) );
BegTime &amp;lt;&amp;lt; Select Where(:Date &amp;lt; Informat(StartDate) |:Date &amp;gt; Informat(EndDate))&amp;lt;&amp;lt;Exclude;));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To check the columns I tried this (below)&amp;nbsp;but did not get a result.&amp;nbsp; Just ".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;BegTime &amp;lt;&amp;lt;new column("blah", numeric, formula(
num(:Date) - num(StartDate);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 13:59:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53805#M30393</guid>
      <dc:creator>KST-CPT</dc:creator>
      <dc:date>2018-03-26T13:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Select Where on Dates</title>
      <link>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53806#M30394</link>
      <description>&lt;P&gt;I am assuming that you are dealing with date data that are JMP date values(numeric values, the number of seconds since Jan 1, 1904).&amp;nbsp; Given that, there is no need to convert them to some value other than a numeric value.&amp;nbsp; Therefore the below should work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;BegTime = dt&amp;lt;&amp;lt; Subset(All rows, Selected columns only( 0 ) );

BegTime &amp;lt;&amp;lt; Select Where(:Date &amp;lt; StartDate |:Date &amp;gt; EndDate)&amp;lt;&amp;lt;Exclude;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Mar 2018 04:50:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53806#M30394</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-03-25T04:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Select Where on Dates</title>
      <link>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53807#M30395</link>
      <description>&lt;P&gt;Yes, that isn't working. Is it possible that my :Date values are not the same as my JMP calendar box() values?&lt;/P&gt;
&lt;P&gt;This is how I cam calculating :Date&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt&amp;lt;&amp;lt; new column ("Date", numeric, continuous, format("m/d/y"), formula(
Date MDY(
Num( Substr( :TimeStamp, 1, 2 ) ),
Num( Substr( :TimeStamp, 4, 2 ) ),
Num( Substr( :TimeStamp, 7, 4 ) ) )
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;:TimeStamp are characters in the format&amp;nbsp;01:28:2018::02:14:08:099&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;StartDate and EndDate are from this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;new window("Start Date of Data",&amp;lt;&amp;lt;Modal, StartDate = Calendar Box());
Show( Short Date( StartDate &amp;lt;&amp;lt; Get Date ) );
new window("End Date of Data",&amp;lt;&amp;lt;Modal, EndDate = Calendar Box());
Show( Short Date( EndDate &amp;lt;&amp;lt; Get Date ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Mar 2018 14:00:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53807#M30395</guid>
      <dc:creator>KST-CPT</dc:creator>
      <dc:date>2018-03-26T14:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Select Where on Dates</title>
      <link>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53808#M30396</link>
      <description>&lt;P&gt;:Date is definetly a value in seconds from 01JAN1904.&amp;nbsp; If I remove the "m/d/y" formatting it is a similar number to the CalendarBox() numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't even subtract these numbers from each other though.&amp;nbsp; very confused?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Mar 2018 05:40:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53808#M30396</guid>
      <dc:creator>KST-CPT</dc:creator>
      <dc:date>2018-03-25T05:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Select Where on Dates</title>
      <link>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53809#M30397</link>
      <description>&lt;P&gt;I think your issue is that you are thinking that StartDate and EndDate are numeric dates.&amp;nbsp; The way you have constructed your code, StartDate and EndDate are pointers to objects.&amp;nbsp; You need to extract the date values from the objects and place them into variables of your choosing.&amp;nbsp; Also, your use a Modal window will not let any processing run, such as the setting of the range of the choices for the dates to choose from.&amp;nbsp; So I have also removed that restriction.&amp;nbsp; So if you follow the logic of the script below, you will see how to handle the processing control without using Modal windows.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Time Series\Raleigh Temps.jmp" );
dt &amp;lt;&amp;lt; clear row states;
startNW = New Window( "Start Date of Data",
	StartDate = Calendar Box(),
	Button Box( "OK",
		startNW &amp;lt;&amp;lt; close window;
		runEndDate;
	)
	
);
StartDate &amp;lt;&amp;lt; Max Date( Col Max( :name( "Month/Year" ) ) ) &amp;lt;&amp;lt; Min Date( Col Min( :Name( "Month/Year" ) ) );


StartDate &amp;lt;&amp;lt; Set Function( Function( {this, date}, theStartDate = StartDate &amp;lt;&amp;lt; Get Date ) );

runEndDate = Expr(
	endNW = New Window( "End Date of Data",
		EndDate = Calendar Box(),
		Button Box( "OK",
			endNW &amp;lt;&amp;lt; close window;
			runSelect;
		)
	);
	endDate &amp;lt;&amp;lt; Max Date( Col Max( :name( "Month/Year" ) ) ) &amp;lt;&amp;lt; Min Date( Col Min( :Name( "Month/Year" ) ) );
	EndDate &amp;lt;&amp;lt; Set Function( Function( {this, date}, theEndDate = endDate &amp;lt;&amp;lt; Get Date ) );
);

runSelect = Expr(
	dt &amp;lt;&amp;lt; select where( :Name( "Month/Year" ) &amp;lt; theStartDate | :Name( "Month/Year" ) &amp;gt; theEndDate )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Mar 2018 06:20:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-Where-on-Dates/m-p/53809#M30397</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-03-25T06:20:51Z</dc:date>
    </item>
  </channel>
</rss>

