<?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 unexpected formatted  input in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/unexpected-formatted-input/m-p/707701#M217324</link>
    <description>&lt;P&gt;I have a txt file test1.txt: 36 95 (with one space between) and try to load to SAS table through the following codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test2;&lt;BR /&gt;infile "/folders/myfolders/test1.txt";&lt;BR /&gt;input @1 height 2. &lt;BR /&gt;@4 weight 2.;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;but if I miss period in the second format&amp;nbsp;@4 weight 2; the test2 will be 36 2. if change to&amp;nbsp;@4 weight 1, test2 will be 36 7. Looks the result is not expected. Anyway, this is a wrong code.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Dec 2020 16:29:12 GMT</pubDate>
    <dc:creator>anming</dc:creator>
    <dc:date>2020-12-22T16:29:12Z</dc:date>
    <item>
      <title>unexpected formatted  input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unexpected-formatted-input/m-p/707701#M217324</link>
      <description>&lt;P&gt;I have a txt file test1.txt: 36 95 (with one space between) and try to load to SAS table through the following codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test2;&lt;BR /&gt;infile "/folders/myfolders/test1.txt";&lt;BR /&gt;input @1 height 2. &lt;BR /&gt;@4 weight 2.;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;but if I miss period in the second format&amp;nbsp;@4 weight 2; the test2 will be 36 2. if change to&amp;nbsp;@4 weight 1, test2 will be 36 7. Looks the result is not expected. Anyway, this is a wrong code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 16:29:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unexpected-formatted-input/m-p/707701#M217324</guid>
      <dc:creator>anming</dc:creator>
      <dc:date>2020-12-22T16:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: unexpected formatted  input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unexpected-formatted-input/m-p/707705#M217328</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test2;
infile "/folders/myfolders/test1.txt" dlm = ' ' truncover;
input  height  weight ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What about something more basic like the following but more specifications on the INFILE statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356091"&gt;@anming&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a txt file test1.txt: 36 95 (with one space between) and try to load to SAS table through the following codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test2;&lt;BR /&gt;infile "/folders/myfolders/test1.txt";&lt;BR /&gt;input @1 height 2. &lt;BR /&gt;@4 weight 2.;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;but if I miss period in the second format&amp;nbsp;@4 weight 2; the test2 will be 36 2. if change to&amp;nbsp;@4 weight 1, test2 will be 36 7. Looks the result is not expected. Anyway, this is a wrong code.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 16:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unexpected-formatted-input/m-p/707705#M217328</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-12-22T16:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: unexpected formatted  input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unexpected-formatted-input/m-p/707711#M217330</link>
      <description>&lt;P&gt;I think that when you remove the period then SAS stops recognizing the format but then starts to interpret the number as the column number.&amp;nbsp; It then takes the single digit and places it in &lt;CODE class=" language-sas"&gt;weight&lt;/CODE&gt;. I could not replicate getting the "7" using &lt;CODE class=" language-sas"&gt;datalines&lt;/CODE&gt;.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test2;
  infile datalines;
  input @1 height 2. 
        @4 weight 1; *Chnaging this 1,2,3,4,5;
datalines;
36 95
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;TABLE border="1" width="32.293762655373115%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="29px"&gt;replacing:&lt;/TD&gt;
&lt;TD width="25%" height="29px"&gt;returns&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="29px"&gt;1&lt;/TD&gt;
&lt;TD width="25%" height="29px"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="29px"&gt;2&lt;/TD&gt;
&lt;TD width="25%" height="29px"&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="29px"&gt;3&lt;/TD&gt;
&lt;TD width="25%" height="29px"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="29px"&gt;4&lt;/TD&gt;
&lt;TD width="25%" height="29px"&gt;9&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="29px"&gt;5&lt;/TD&gt;
&lt;TD width="25%" height="29px"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;About the unexpectedness: I don't thin this syntax is itself "expected", so being unexpected syntax I'm sure the result is unexpected too.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 16:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unexpected-formatted-input/m-p/707711#M217330</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2020-12-22T16:49:07Z</dc:date>
    </item>
  </channel>
</rss>

