<?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: binary indicator of late time or early time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/binary-indicator-of-late-time-or-early-time/m-p/841031#M332535</link>
    <description>&lt;P&gt;Simple enough.&amp;nbsp; Since your existing variable is already numeric you can just store the actual time in seconds back into the same variable.&amp;nbsp; Let's use a cutoff that some of the values actually exceed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input time;
cards;
90200
0
181400
160300
113400
;

data want;
  set have;
  time=input(put(time,z6.),hhmmss6.);
  format time tod5.;
  Ind_late_time = time &amp;gt; '18:00:00't ;
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;                 Ind_
                late_
Obs     time     time

 1     09:02      0
 2     00:00      0
 3     18:14      1
 4     16:03      0
 5     11:34      0

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2022 20:53:40 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-10-26T20:53:40Z</dc:date>
    <item>
      <title>binary indicator of late time or early time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/binary-indicator-of-late-time-or-early-time/m-p/841024#M332528</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I have numeric time field and I converted it into sas time field.&lt;/P&gt;
&lt;P&gt;I want to create a new field called "ind_late_time' that is a binary variable that get value 1 if time is after 18:30 (06:30 PM) and value 0 otherwise.&lt;/P&gt;
&lt;P&gt;What is the way to do it please?&lt;/P&gt;
&lt;P&gt;Here&amp;nbsp; is my try that got wrong results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Data have;
Input time;
cards;
90200
0
181400
160300
113400
;
Run;

data have2;
set have;
time_=put(time,z6.);
time_new=input(time_,hhmmss6.);
Format time_new hhmm. ;
drop  time_;
Run;


data want;
set have2;
IF time&amp;gt;='18:30:00't then Ind_late_time=1;
else Ind_late_time=0;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Oct 2022 20:25:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/binary-indicator-of-late-time-or-early-time/m-p/841024#M332528</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-10-26T20:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: binary indicator of late time or early time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/binary-indicator-of-late-time-or-early-time/m-p/841026#M332530</link>
      <description>&lt;P&gt;You create a variable time_new, but use the original time in your condition.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 20:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/binary-indicator-of-late-time-or-early-time/m-p/841026#M332530</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-26T20:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: binary indicator of late time or early time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/binary-indicator-of-late-time-or-early-time/m-p/841031#M332535</link>
      <description>&lt;P&gt;Simple enough.&amp;nbsp; Since your existing variable is already numeric you can just store the actual time in seconds back into the same variable.&amp;nbsp; Let's use a cutoff that some of the values actually exceed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input time;
cards;
90200
0
181400
160300
113400
;

data want;
  set have;
  time=input(put(time,z6.),hhmmss6.);
  format time tod5.;
  Ind_late_time = time &amp;gt; '18:00:00't ;
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;                 Ind_
                late_
Obs     time     time

 1     09:02      0
 2     00:00      0
 3     18:14      1
 4     16:03      0
 5     11:34      0

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 20:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/binary-indicator-of-late-time-or-early-time/m-p/841031#M332535</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-26T20:53:40Z</dc:date>
    </item>
  </channel>
</rss>

