<?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: Creating a data set with time formats in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-data-set-with-time-formats/m-p/676484#M203986</link>
    <description>It works. Just a question: why do you use +1 in: input patient_id $ patient_name $ (enttime draw1 tdiff) (time8. +1);?</description>
    <pubDate>Thu, 13 Aug 2020 13:34:35 GMT</pubDate>
    <dc:creator>ACLAN</dc:creator>
    <dc:date>2020-08-13T13:34:35Z</dc:date>
    <item>
      <title>Creating a data set with time formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-data-set-with-time-formats/m-p/676475#M203983</link>
      <description>&lt;P&gt;Hi. I'm new to SAS and I am trying to create a dataset with the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dtest;&lt;BR /&gt;input patient_id $&lt;BR /&gt;patient_name $;&lt;BR /&gt;format enttime time8.&lt;BR /&gt;draw1 time8.&lt;BR /&gt;tdiff time8.;&lt;BR /&gt;datalines;&lt;BR /&gt;18C020 Garcia 11:45:00 11:50:00 00:07:00&lt;BR /&gt;17C222 Gibson 11:43:00 11:47:00 00:04:00&lt;BR /&gt;18C023 Knapp 11:42:00 11:45:00 00:43:00&lt;BR /&gt;10C032 Mueller 09:11:00 11:47:00 02:36:00&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code runs without any errors but when I check the created dataset, the variables enttime, draw1 and tdiff have missing values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm defining the time with&amp;nbsp;time8 which is suppose to represent time in the hh:mm:ss format but it doesn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 13:19:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-data-set-with-time-formats/m-p/676475#M203983</guid>
      <dc:creator>ACLAN</dc:creator>
      <dc:date>2020-08-13T13:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a data set with time formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-data-set-with-time-formats/m-p/676481#M203985</link>
      <description>&lt;P&gt;You have never given enttime draw and tdiff a value. You have not told SAS to read them in. You have only given them a format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this will work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dtest;
input patient_id $ patient_name $ (enttime draw1 tdiff) (time8. +1);
format enttime draw1 tdiff time8.;
datalines;
18C020 Garcia 11:45:00 11:50:00 00:07:00
17C222 Gibson 11:43:00 11:47:00 00:04:00
18C023 Knapp 11:42:00 11:45:00 00:43:00
10C032 Mueller 09:11:00 11:47:00 02:36:00
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 13:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-data-set-with-time-formats/m-p/676481#M203985</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-13T13:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a data set with time formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-data-set-with-time-formats/m-p/676484#M203986</link>
      <description>It works. Just a question: why do you use +1 in: input patient_id $ patient_name $ (enttime draw1 tdiff) (time8. +1);?</description>
      <pubDate>Thu, 13 Aug 2020 13:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-data-set-with-time-formats/m-p/676484#M203986</guid>
      <dc:creator>ACLAN</dc:creator>
      <dc:date>2020-08-13T13:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a data set with time formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-data-set-with-time-formats/m-p/676485#M203987</link>
      <description>&lt;P&gt;The +1 tells SAS to skip one character (in this case, a space between the different variables) and then start reading the next variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you leave out the +1, you get NOTEs in the LOG, and you can see from what the LOG is saying that SAS is trying to read the last variable in the wrong columns.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 13:41:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-data-set-with-time-formats/m-p/676485#M203987</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-13T13:41:07Z</dc:date>
    </item>
  </channel>
</rss>

