<?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: Reading a DATETIME format variable into SAS in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285573#M59432</link>
    <description>&lt;P&gt;oh that's why. You guys are wonderful!!! Thanks so much!&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2016 16:59:00 GMT</pubDate>
    <dc:creator>braveblade</dc:creator>
    <dc:date>2016-07-19T16:59:00Z</dc:date>
    <item>
      <title>Reading a DATETIME format variable into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285390#M59418</link>
      <description>&lt;P&gt;Hi guys. New SAS user here. I need some help regarding reading a DATETIME format variable into SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The datafile's name is "test.txt". The variables are seprated by tab:&lt;/P&gt;&lt;P&gt;24-Jun-2012 03:39:00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 79&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used DATETIME format to read the first variable with length 20 as follows:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; testing2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;infile&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'C:\test.txt'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DLM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'09'X&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DSD&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;MISSOVER&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; date &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;DATETIME20.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; number2; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;It does not work. SAS read the first variable correctly, but read second variable as missing value.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;If I add an +1 in the end of the first variable, it works. I don't know why.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; testing2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;infile&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'C:\test.txt'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DLM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'09'X&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DSD&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;MISSOVER&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; date &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;DATETIME20.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; number2; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;If I use the colon modifier and keep the length as 20 it works:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; testing2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;infile&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'C:\test.txt'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DLM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'09'X&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DSD&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;MISSOVER&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; date :&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;DATETIME20.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; number2; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;If I use the colon modifier and&amp;nbsp;use the length as&amp;nbsp;15 it still works:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;infile&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;'C:\test.txt'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DLM&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'09'X&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DSD&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;MISSOVER&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; date :&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;DATETIME15.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; number2; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;I'm so confused. The length of the first variable is 20, so :&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;DATETIME20.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; should work but it doesn't. Why adding +1 or use colon modifier (even at length 15) work? &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Also, am i correct on the following statement: &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Formatted input: SAS Pointer moves to the next column after reading the variable with formatted input. So if the delimiter is tab, after reading the variable with formatted input, the pointer is actually at the position of TAB. In order to read next variable, I need to use +1 to skip the TAB.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Colon modifier: SAS Pointer moves to the beginning position of next variable after reading the variable with colon modifier.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Please help! Thanks!!!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 23:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285390#M59418</guid>
      <dc:creator>braveblade</dc:creator>
      <dc:date>2016-07-18T23:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a DATETIME format variable into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285407#M59419</link>
      <description>&lt;P&gt;When I use delimited infile code, I predefine all my variables with an attrib statement (or informat/format/length - but attrib is tidier). By not putting the length to be read in the input statement, it follows the delimiter control; the converse (as you have (understandably) done it) puts the cursor past the delimiter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;infile cards dsd dlm='09'x;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;attrib date informat=datetime20. format=datetime20.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;input date &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; num;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;put date= datetime20.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; num;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;stop;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;cards;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;24-Jun-2012 03:39:00 79&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 23:54:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285407#M59419</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2016-07-18T23:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a DATETIME format variable into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285564#M59428</link>
      <description>&lt;P&gt;When you put the informat on the input statement it forces the entire length of the specification to be read.&amp;nbsp; DSD is also interacting with your data; see the example lines of code below. I'm using a comma delimiter so it may be seen.&lt;/P&gt;
&lt;P&gt;The first replicates your issue as an error , the other two work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data junk;
   infile datalines dlm=',' dsd;
   input date DATETIME20. number2; 
format 
datalines;
24-Jun-2012 03:39:00,79
run;

data junk2;
   infile datalines dlm=',';
   input date DATETIME20. number2; 
datalines;
24-Jun-2012 03:39:00,79
run;

data junk3;
   infile datalines dlm=',' dsd;
   informat date datetime20.;
   input date  number2; 
datalines;
24-Jun-2012 03:39:00,79
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would also check to see if your data file by chance has 2 tabs before the number as DSD will treat that, 2 consecutive delimiters, as a missing value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 16:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285564#M59428</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-19T16:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a DATETIME format variable into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285568#M59429</link>
      <description>&lt;P&gt;You are having trouble because of the space embedded into the value. When you use the : modifier it will only read the date part of your datatime value because of the embedded space.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As others have said just don't include the format in the INPUT statement. &amp;nbsp;Use an INFORMAT statement instead to let SAS know how to read the value for that variable.&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-sas"&gt;data testing2;
  infile cards dlm='|' dsd truncover;
  length date number2 8;
  informat date datetime20.;
  format date datetime20.;
  input date  number2;
CARDS;
24-Jun-2012 03:39:00|79
4-Jun-2012 3:39:00|79
24Jun2012 03:39:00|79
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 16:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285568#M59429</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-07-19T16:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a DATETIME format variable into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285569#M59430</link>
      <description>&lt;P&gt;Thanks! I tried the last part of codes and it still&amp;nbsp;reads the full length of date and time&amp;nbsp;even I change the datetime length to 13. I'm no longer putting the informat on the input statement. Could you explain why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; junk3&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; datalines dlm&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;','&lt;/SPAN&gt; dsd&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token statement"&gt;informat&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;date&lt;/SPAN&gt; datetime13&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;date&lt;/SPAN&gt;&amp;nbsp; number2&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;datalines&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token number"&gt;24&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;Jun&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2012&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;03&lt;/SPAN&gt;:&lt;SPAN class="token number"&gt;39&lt;/SPAN&gt;:&lt;SPAN class="token number"&gt;00&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;79&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 16:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285569#M59430</guid>
      <dc:creator>braveblade</dc:creator>
      <dc:date>2016-07-19T16:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a DATETIME format variable into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285570#M59431</link>
      <description>&lt;P&gt;When using the DSD option SAS will ignore the width specified in the INFORMAT and just use the width of the actual data.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 16:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285570#M59431</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-07-19T16:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a DATETIME format variable into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285573#M59432</link>
      <description>&lt;P&gt;oh that's why. You guys are wonderful!!! Thanks so much!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 16:59:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285573#M59432</guid>
      <dc:creator>braveblade</dc:creator>
      <dc:date>2016-07-19T16:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a DATETIME format variable into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285661#M59434</link>
      <description>&lt;P&gt;Not quite - the original problem posited that the variables were separated by tabs, or '09'x. As long as that's the case, internal spaces are fine.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 22:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-a-DATETIME-format-variable-into-SAS/m-p/285661#M59434</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2016-07-19T22:26:04Z</dc:date>
    </item>
  </channel>
</rss>

