<?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: datalines char length still set to 8 even though length is explicitly set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904574#M357383</link>
    <description>Nevermind, I was typing '09x' which was causing error</description>
    <pubDate>Sun, 26 Nov 2023 19:45:14 GMT</pubDate>
    <dc:creator>current_thing</dc:creator>
    <dc:date>2023-11-26T19:45:14Z</dc:date>
    <item>
      <title>datalines char length still set to 8 even though length is explicitly set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904561#M357380</link>
      <description>&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data test;
length _character_ $25.;
infile datalines delimiter='	'; 
input
season
basin $
storm $
windrank
windmph
;
datalines;
1980	ep	agathaagatha	1	100
1980	ep	agatha	2	95
;
run;&lt;/PRE&gt;&lt;P&gt;Within the first row, the &lt;STRONG&gt;Storm&lt;/STRONG&gt; value is truncated. That's because the column properties show:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="current_thing_0-1701022965282.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90195iBB74288B0524BF4C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="current_thing_0-1701022965282.png" alt="current_thing_0-1701022965282.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2023 18:26:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904561#M357380</guid>
      <dc:creator>current_thing</dc:creator>
      <dc:date>2023-11-26T18:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: datalines char length still set to 8 even though length is explicitly set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904569#M357381</link>
      <description>&lt;P&gt;DATALINES as nothing to do with this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is this statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length _character_ $25.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You are using the variable list _CHARACTER_ but at that point you have not defined any character variables, so the list is EMPTY.&amp;nbsp; The problem is that the variable has to be defined as CHARACTER to be part of the list, but once it is defined the LENGTH is already set so you cannot change it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to set the lengths of variables you have to actually use the names of the variables.&amp;nbsp; You can use a list of names with numeric suffixes, but not other types of variable lists.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have set the order of the variables you can use a positional variable list in the INPUT statement to save some typing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length season 8 basin storm $25 windrank windmph 8;
  input season -- windmph ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you can use the fact that SAS will GUESS that you want to LENGTH of the variable match the WIDTH of a format or informat you use when the variable is first mentioned.&amp;nbsp; Just include the informat in the INPUT statement, but make sure to use the colon modifier so that the field is still read in LIST MODE.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  input season  basin :$25. storm :$25. windrank windmph ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also your post looks like you are trying to use space as the delimiter, but that is the default.&amp;nbsp; If you intended to use TAB as the delimiter then :&lt;/P&gt;
&lt;P&gt;1) Use '09'x in the INFILE statement to make that CLEAR.&lt;/P&gt;
&lt;P&gt;2) Don't do it with in-line data (datalines aka cards) because tabs can be (and probably should be) converted to spaces when included in a program.&amp;nbsp; And if you submit the code from Display Manager program editor they WILL be converted to spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2023 19:15:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904569#M357381</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-26T19:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: datalines char length still set to 8 even though length is explicitly set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904571#M357382</link>
      <description>Thank you Tom! Using Length to specify individual columns worked. I did intend to use tab as delimiter because I copied from Excel. Please explain how to use '09'x in the INFILE?</description>
      <pubDate>Sun, 26 Nov 2023 19:40:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904571#M357382</guid>
      <dc:creator>current_thing</dc:creator>
      <dc:date>2023-11-26T19:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: datalines char length still set to 8 even though length is explicitly set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904574#M357383</link>
      <description>Nevermind, I was typing '09x' which was causing error</description>
      <pubDate>Sun, 26 Nov 2023 19:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904574#M357383</guid>
      <dc:creator>current_thing</dc:creator>
      <dc:date>2023-11-26T19:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: datalines char length still set to 8 even though length is explicitly set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904590#M357384</link>
      <description>&lt;P&gt;I usually just convert the tabs to something else that humans can see.&amp;nbsp; Like |.&lt;/P&gt;
&lt;P&gt;It is easy if you use SAS program editor:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;change '09'x '|' all&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have to point and click through some GUI interface it is only a little harder.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2023 22:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datalines-char-length-still-set-to-8-even-though-length-is/m-p/904590#M357384</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-26T22:04:45Z</dc:date>
    </item>
  </channel>
</rss>

