<?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 How to find fields with trailing or leading space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-fields-with-trailing-or-leading-space/m-p/107247#M258638</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a field named Product with some fields having trailing and leading spaces. What code should I use to spot all the products with leading and trailing space out of million observations? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; font-family: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;The spaces below are denoted as ... &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Product&amp;nbsp; &lt;/P&gt;&lt;P&gt;Milk..&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;..Banana&amp;nbsp; &lt;/P&gt;&lt;P&gt;Orange..&amp;nbsp; &lt;/P&gt;&lt;P&gt;Pear..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 23 Dec 2012 20:20:49 GMT</pubDate>
    <dc:creator>sasthebest</dc:creator>
    <dc:date>2012-12-23T20:20:49Z</dc:date>
    <item>
      <title>How to find fields with trailing or leading space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-fields-with-trailing-or-leading-space/m-p/107247#M258638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a field named Product with some fields having trailing and leading spaces. What code should I use to spot all the products with leading and trailing space out of million observations? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; font-family: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;The spaces below are denoted as ... &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Product&amp;nbsp; &lt;/P&gt;&lt;P&gt;Milk..&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;..Banana&amp;nbsp; &lt;/P&gt;&lt;P&gt;Orange..&amp;nbsp; &lt;/P&gt;&lt;P&gt;Pear..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Dec 2012 20:20:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-fields-with-trailing-or-leading-space/m-p/107247#M258638</guid>
      <dc:creator>sasthebest</dc:creator>
      <dc:date>2012-12-23T20:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to find fields with trailing or leading space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-fields-with-trailing-or-leading-space/m-p/107248#M258639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS stores character strings as fixed length fields so any short string is padded with spaces to the length of the field. Hence there is no such things as "trailing" spaces. To find character strings with leading spaces just test if it starts with a space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if product =: ' ' then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Dec 2012 20:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-fields-with-trailing-or-leading-space/m-p/107248#M258639</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-12-23T20:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to find fields with trailing or leading space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-fields-with-trailing-or-leading-space/m-p/107249#M258640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Trailing spaces are inconsequential in SAS as it only handles fixed length character strings; i.e. all character strings are padded with spaces. The number of leading spaces is given by LENGTH(Product) - STRIP(Product).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Dec 2012 20:55:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-fields-with-trailing-or-leading-space/m-p/107249#M258640</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-12-23T20:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to find fields with trailing or leading space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-fields-with-trailing-or-leading-space/m-p/107250#M258641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If what you mean "trailing" is to find how many blanks are padded, you could try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lengthc(product)-length(product);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Dec 2012 21:47:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-fields-with-trailing-or-leading-space/m-p/107250#M258641</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-12-23T21:47:39Z</dc:date>
    </item>
  </channel>
</rss>

