<?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 Datalines with varying length in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400214#M25724</link>
    <description>&lt;P&gt;Windows 10, SAS Base 9.4, SAS Enterprise Guide 7.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble creating a dataset using datalines.&lt;/P&gt;&lt;P&gt;The code&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test1;
    Infile datalines delimiter=",";
    Input str $ num;
    datalines;
abcdefghi,0
zyxwvut,1
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;yields&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test1.PNG" style="width: 160px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15527i0AA5C6DBD918F4FA/image-size/large?v=v2&amp;amp;px=999" role="button" title="test1.PNG" alt="test1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The str variable is truncated at the eigth character (by default). In order to try to fix this I tried adjusting the length:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test2;
    Infile datalines delimiter=",";
    Input str $9. num;
    datalines;
abcdefghi,0
zyxwvut,1
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But this also doesn't do what I want since the numbers after the delimiter are being read into &lt;EM&gt;str:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test2.PNG" style="width: 167px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15528i89D2968206979629/image-size/large?v=v2&amp;amp;px=999" role="button" title="test2.PNG" alt="test2.PNG" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;How can I fix this?&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2017 10:11:37 GMT</pubDate>
    <dc:creator>Autotelic</dc:creator>
    <dc:date>2017-10-02T10:11:37Z</dc:date>
    <item>
      <title>Datalines with varying length</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400214#M25724</link>
      <description>&lt;P&gt;Windows 10, SAS Base 9.4, SAS Enterprise Guide 7.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble creating a dataset using datalines.&lt;/P&gt;&lt;P&gt;The code&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test1;
    Infile datalines delimiter=",";
    Input str $ num;
    datalines;
abcdefghi,0
zyxwvut,1
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;yields&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test1.PNG" style="width: 160px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15527i0AA5C6DBD918F4FA/image-size/large?v=v2&amp;amp;px=999" role="button" title="test1.PNG" alt="test1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The str variable is truncated at the eigth character (by default). In order to try to fix this I tried adjusting the length:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test2;
    Infile datalines delimiter=",";
    Input str $9. num;
    datalines;
abcdefghi,0
zyxwvut,1
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But this also doesn't do what I want since the numbers after the delimiter are being read into &lt;EM&gt;str:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test2.PNG" style="width: 167px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15528i89D2968206979629/image-size/large?v=v2&amp;amp;px=999" role="button" title="test2.PNG" alt="test2.PNG" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;How can I fix this?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2017 10:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400214#M25724</guid>
      <dc:creator>Autotelic</dc:creator>
      <dc:date>2017-10-02T10:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines with varying length</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400217#M25725</link>
      <description>&lt;P&gt;You just need a slight amendment - use a length statement first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test2;
	length str $9;
    Infile datalines delimiter=",";
    Input str $ num;
    datalines;
abcdefghi,0
zyxwvut,1
;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Oct 2017 10:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400217#M25725</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-10-02T10:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines with varying length</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400218#M25726</link>
      <description>&lt;P&gt;Just to add to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32246"&gt;@ChrisBrooks&lt;/a&gt;&amp;nbsp;excellent advice, you should read the manual on the sections about defaults so you understand what is going on.&amp;nbsp; Because you have not previously set the length of a character variable, the default in SAS is to have a length of 8, therefore when the string is read in, only 8 characters can be present.&amp;nbsp; The solution given explicitly defines the length of that variable to be 9 therefore can read in 9 characters.&amp;nbsp; It is very important to always specify lengths (and types) on variables before you start to use them, otherwise you may not end up with the result you want.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With these data imports it is always useful (if from third party but maybe also on other scenarios too) to have a data specification document which details what each fields type, length, format, and possibly code list is, so that anyone picking up the data can easily see the data structure and can interpret it without ambiguity.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2017 10:39:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400218#M25726</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-02T10:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines with varying length</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400219#M25727</link>
      <description>&lt;P&gt;A very slight modification will make your second code work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test2;
    Infile datalines delimiter=",";
    Input str :$9. num;
    datalines;
abcdefghi,0
zyxwvut,1
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Oct 2017 10:40:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400219#M25727</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-02T10:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines with varying length</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400232#M25731</link>
      <description>Can you tell me where to read about your solution ":". I can't find it at &lt;A href="http://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0oaql83drile0n141pdacojq97s.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=pt" target="_blank"&gt;http://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0oaql83drile0n141pdacojq97s.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=pt&lt;/A&gt;</description>
      <pubDate>Mon, 02 Oct 2017 12:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400232#M25731</guid>
      <dc:creator>Autotelic</dc:creator>
      <dc:date>2017-10-02T12:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines with varying length</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400266#M25732</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/163649"&gt;@Autotelic&lt;/a&gt; wrote:&lt;BR /&gt;Can you tell me where to read about your solution ":". I can't find it at &lt;A href="http://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0oaql83drile0n141pdacojq97s.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=pt" target="_blank"&gt;http://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0oaql83drile0n141pdacojq97s.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=pt&lt;/A&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's part of list input:&amp;nbsp;&lt;A href="http://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0lrz3gb7m9e4rn137op544ddg0v.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=de" target="_blank"&gt;http://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0lrz3gb7m9e4rn137op544ddg0v.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=de&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2017 14:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Datalines-with-varying-length/m-p/400266#M25732</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-02T14:10:48Z</dc:date>
    </item>
  </channel>
</rss>

