<?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: Extrange results using trim and compress functions in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737369#M38720</link>
    <description>&lt;P&gt;Well, it looks like you are reading the data in wrong from the get-go so not really an issue with blanks. It appears that your encoding is wrong somewhere or else you are reading in a source that is not text. As mentioned, what is the data source? It may be UTF-8/16 (or whatever).&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Apr 2021 18:32:26 GMT</pubDate>
    <dc:creator>AlanC</dc:creator>
    <dc:date>2021-04-27T18:32:26Z</dc:date>
    <item>
      <title>Strange results using trim and compress functions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737258#M38705</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to remove blanks from a string using compress or trim functions but the result I'm getting looks like this one below, with an unrecognize characters and&amp;nbsp; I don't have idea what is happening here.&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="rodrichiez_0-1619528924585.png" style="width: 675px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58724iD7F923926C52CC97/image-dimensions/675x123?v=v2" width="675" height="123" role="button" title="rodrichiez_0-1619528924585.png" alt="rodrichiez_0-1619528924585.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This is my code:&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE WORK.QUERY_FOR_FILTER AS&lt;BR /&gt;SELECT t1.Interest_Plan,&lt;BR /&gt;(COMPRESS(t1.Interest_Plan)) AS COMPRESS,&lt;BR /&gt;(TRIM(LEFT(t1.Interest_Plan))) AS TRIM,&lt;BR /&gt;(COUNT(t1.Account_Nbr)) AS COUNT_of_Account_Nbr&lt;BR /&gt;FROM WORK.FILTER_FOR_FACT t1&lt;BR /&gt;GROUP BY t1.Interest_Plan,&lt;BR /&gt;(CALCULATED COMPRESS),&lt;BR /&gt;(CALCULATED TRIM);&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 15:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737258#M38705</guid>
      <dc:creator>rodrichiez</dc:creator>
      <dc:date>2021-04-27T15:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extrange results using trim and compress functions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737263#M38706</link>
      <description>&lt;P&gt;Create a control variable for the source value.&lt;/P&gt;
&lt;P&gt;Define it with double the length of interest_plan, and use the $HEX format to store the hex representation of the source value there. This way you can see if there's some crazy stuff in there after a series of blanks.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 13:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737263#M38706</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-27T13:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extrange results using trim and compress functions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737266#M38707</link>
      <description>&lt;P&gt;TRIM() just removes the trailing spaces, which will just be added back once you store the value into a SAS character variable. SAS character variables are fixed length and padded with spaces.&amp;nbsp; So it will not have any effect.&lt;/P&gt;
&lt;P&gt;LEFT() will remove leading spaces, so that might have an impact.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The COMPRESS() function will remove all of the spaces, even those in the middle of the string between the words.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is hard to tell what is in your data from looking a photograph of how some viewer displays the data.&amp;nbsp; Print the data using the $HEX format to see what characters are in the data.&amp;nbsp; A space will show as the hexadecimal code 20 (which is 32 in base 10).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=QUERY_FOR_FILTER(obs=3) ;
 format _character_ $hex. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Apr 2021 13:34:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737266#M38707</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-27T13:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extrange results using trim and compress functions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737269#M38708</link>
      <description>&lt;P&gt;Use the STRIP function. If the raw data is such that you can pull it into a hex editor, try that. UltraEdit, Notepad++, and (my favorite for hex issues) 010 Editor can all show you the values. Look at encoding setup as well to make sure you are reading the values correctly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 13:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737269#M38708</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2021-04-27T13:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extrange results using trim and compress functions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737334#M38711</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See attached the results.But I still don't get it on how to normalize this column to perform a group by.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 17:13:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737334#M38711</guid>
      <dc:creator>rodrichiez</dc:creator>
      <dc:date>2021-04-27T17:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extrange results using trim and compress functions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737337#M38712</link>
      <description>&lt;P&gt;XLSX is not a good format to post results. Use text in the future so the hex values can be seen. Here is pseudo-code (aka I can't test it).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;PROC SQL;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CREATE TABLE WORK.QUERY_FOR_FILTER AS&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SELECT STRIP(t1.Interest_Plan) AS IntPlan,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; COUNT(t1.&lt;SPAN&gt;Account_Nbr&lt;/SPAN&gt;) AS Count&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FROM WORK.FILTER_FOR_FACT t1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GROUP BY IntPlan&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;QUIT;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 17:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737337#M38712</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2021-04-27T17:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extrange results using trim and compress functions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737341#M38713</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13798"&gt;@AlanC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It happen the same using Strip function.&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="rodrichiez_0-1619544655300.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58740i48FAB9340F2AEAD9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rodrichiez_0-1619544655300.png" alt="rodrichiez_0-1619544655300.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 17:31:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737341#M38713</guid>
      <dc:creator>rodrichiez</dc:creator>
      <dc:date>2021-04-27T17:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extrange results using trim and compress functions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737348#M38715</link>
      <description>&lt;P&gt;I do not understand what you are actually trying to do.&lt;/P&gt;
&lt;P&gt;But the data you posted is showing you have a lot of gibberish in your data.&amp;nbsp; For example it appears to have a lot of binary zero bytes.&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="image.png" style="width: 705px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58742iB303BC5488CF97F4/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Where did you get this data?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have it in a SAS dataset?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some other source?&lt;/P&gt;
&lt;P&gt;Where did that source get the data?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 17:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737348#M38715</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-27T17:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extrange results using trim and compress functions</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737369#M38720</link>
      <description>&lt;P&gt;Well, it looks like you are reading the data in wrong from the get-go so not really an issue with blanks. It appears that your encoding is wrong somewhere or else you are reading in a source that is not text. As mentioned, what is the data source? It may be UTF-8/16 (or whatever).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 18:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Strange-results-using-trim-and-compress-functions/m-p/737369#M38720</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2021-04-27T18:32:26Z</dc:date>
    </item>
  </channel>
</rss>

