<?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: Delate length above 15 character observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833892#M329692</link>
    <description>&lt;P&gt;If the goal is to check how long the string was on the line that is being read then testing the length of what ended up in the variable is the wrong test.&lt;/P&gt;
&lt;P&gt;Instead you could test how many characters before the last non-blank character there were in the line by testing the _INFILE_ automatic variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input string $15.;
if length(_infile_) &amp;gt; 15 then delete;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 16 Sep 2022 16:31:38 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-09-16T16:31:38Z</dc:date>
    <item>
      <title>Delate length above 15 character observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833772#M329622</link>
      <description>&lt;P&gt;data ds ;&lt;/P&gt;&lt;P&gt;infile datalines ;&lt;/P&gt;&lt;P&gt;input name$ 15;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;abc_11234567898&lt;/P&gt;&lt;P&gt;abc_112345678989&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;in above data I have 15 &amp;nbsp;characters length observation only &amp;nbsp;only , above 15 &amp;nbsp;character length I don't. please anyone help me how to remove above 15 char length variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 07:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833772#M329622</guid>
      <dc:creator>venunaidu</dc:creator>
      <dc:date>2022-09-16T07:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Delate length above 15 character observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833795#M329639</link>
      <description>&lt;P&gt;A few points ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Evidently you made an error posting the question.&amp;nbsp; The INPUT statement is missing a dot:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input name$ 15.;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;not&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input name$ 15;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want more than 15 characters, you need to define a variable that is more than 15 characters long.&amp;nbsp; One way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds ;
infile datalines ;
length name $ 16;
input name;
cards;
abc_11234567898
abc_112345678989
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the LENGTH statement, choose whatever length you would like for your variable.&amp;nbsp; It doesn't have to be 16.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notice that once the variable's length is already defined by the LENGTH statement, you can simplify the INPUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also notice that you don't need a RUN; statement.&amp;nbsp; Since the CARDS section can only appear at the end of a DATA step, the presence of a CARDS statement triggers SAS to run the DATA step (whether or not you have a RUN statement).&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 09:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833795#M329639</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-09-16T09:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Delete length above 15 character observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833867#M329676</link>
      <description>above data i have 15 char observation only output ,remaining more than 15&lt;BR /&gt;char or below 15 char should be deleted please help me on that .&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:31:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833867#M329676</guid>
      <dc:creator>venunaidu</dc:creator>
      <dc:date>2022-09-16T14:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Delete length above 15 character observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833873#M329678</link>
      <description>&lt;P&gt;The LENGTH function will measure the length of variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DELETE statement will delete observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In combination:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds ;
infile datalines ;
length name $ 16;
input name;
if length(name) ne 15 then delete;
cards;
abc_11234567898
abc_112345678989
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;DO NOT set the length of NAME to 15, or else you can't detect those rows that originally were longer than 15.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833873#M329678</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-09-16T14:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Delate length above 15 character observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833892#M329692</link>
      <description>&lt;P&gt;If the goal is to check how long the string was on the line that is being read then testing the length of what ended up in the variable is the wrong test.&lt;/P&gt;
&lt;P&gt;Instead you could test how many characters before the last non-blank character there were in the line by testing the _INFILE_ automatic variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input string $15.;
if length(_infile_) &amp;gt; 15 then delete;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Sep 2022 16:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delate-length-above-15-character-observation/m-p/833892#M329692</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-16T16:31:38Z</dc:date>
    </item>
  </channel>
</rss>

