<?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 Compress not eliminating hex values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848440#M335445</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shouldn't the compress function eliminate the repeating "20"?&lt;/P&gt;&lt;P&gt;27 data check;&lt;BR /&gt;28 set in.CK14_data2(firstobs=2 obs=2);&lt;BR /&gt;29 put state state hex16.;&lt;BR /&gt;30 statex=compress(state,'20'x);&lt;BR /&gt;31 put statex statex hex16.;&lt;BR /&gt;32 run;&lt;/P&gt;&lt;P&gt;DC 4443202020202020&lt;BR /&gt;DC 4443202020202020&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2022 23:06:41 GMT</pubDate>
    <dc:creator>Batman</dc:creator>
    <dc:date>2022-12-07T23:06:41Z</dc:date>
    <item>
      <title>Compress not eliminating hex values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848440#M335445</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shouldn't the compress function eliminate the repeating "20"?&lt;/P&gt;&lt;P&gt;27 data check;&lt;BR /&gt;28 set in.CK14_data2(firstobs=2 obs=2);&lt;BR /&gt;29 put state state hex16.;&lt;BR /&gt;30 statex=compress(state,'20'x);&lt;BR /&gt;31 put statex statex hex16.;&lt;BR /&gt;32 run;&lt;/P&gt;&lt;P&gt;DC 4443202020202020&lt;BR /&gt;DC 4443202020202020&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 23:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848440#M335445</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2022-12-07T23:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compress not eliminating hex values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848441#M335446</link>
      <description>&lt;P&gt;I think in this case the Put is showing the trailing spaces to the length of the defined variable.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;265  data _null_;
266    length y $ 6;
267    y='D';
268    put  y= hex16. ;
269  run;

y=442020202020
&lt;/PRE&gt;
&lt;P&gt;No actual spaces assigned after the D but the result with 5 pairs of 20 in the hex output is shown.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is somewhat analogous to using a 10.8 format to display the value of 1. The format includes the 8 zeroes after the decimal.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 23:31:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848441#M335446</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-12-07T23:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Compress not eliminating hex values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848442#M335447</link>
      <description>&lt;P&gt;Hexadecimal 20 is the ASCII space character. Character variables in SAS are always padded with spaces beyond the last non-blank character to the length of the variable. That is why compressing space characters will have no effect to the right of the last non-blank character.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 23:42:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848442#M335447</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-12-07T23:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Compress not eliminating hex values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848472#M335454</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;statex=compress(state,'20'x);&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This means: Remove all \x20 characters -aka spaces- from the value stored in the variable STATE.&lt;/P&gt;
&lt;P&gt;It's the same as:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;statex=compress(state);&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;and the function does that. Then the value is stored in the variable.&lt;/P&gt;
&lt;P&gt;If the variable is longer than the value, the value is right-padded with spaces.&lt;/P&gt;
&lt;P&gt;If the variable is shorter than the value, the value is truncated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 07:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848472#M335454</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2022-12-08T07:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compress not eliminating hex values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848576#M335490</link>
      <description>&lt;P&gt;It did.&amp;nbsp; &amp;nbsp;Remember that SAS only has two types of variables.&amp;nbsp; Floating point numbers and fixed length character strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you assigned the value 'DC' to the variable the result is that the rest of the variable is filled with spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;76   data test;
77     length state1 $2 state2 $8 ;
78     state1='DC';
79     state2='DC';
80     put (state1 state2) (=$hex./);
81   run;

state1=4443
state2=4443202020202020
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 19:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compress-not-eliminating-hex-values/m-p/848576#M335490</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-10T19:38:11Z</dc:date>
    </item>
  </channel>
</rss>

