<?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 Help deciphering this code in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Help-deciphering-this-code/m-p/166042#M43037</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;A short question&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working through a code that I am trying to understand and modify&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;SPAN class="s1"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;select&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;distinct&lt;/SPAN&gt; Var1, &lt;/P&gt;&lt;P class="p2"&gt;compress(put&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;(sum(Var2),&lt;/SPAN&gt;&lt;SPAN class="s3" style="font-size: 10pt; line-height: 1.5em;"&gt;comma7.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;||&lt;/SPAN&gt;&lt;SPAN class="s4" style="font-size: 10pt; line-height: 1.5em;"&gt;"/"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;|| &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;put(sum(Var3),&lt;/SPAN&gt;&lt;SPAN class="s3" style="font-size: 10pt; line-height: 1.5em;"&gt;comma12.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;from&lt;SPAN class="s1"&gt; x&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;group&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;by&lt;/SPAN&gt; Var1;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;SPAN class="s1"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Could anyone please explain in simple wording what this code is doing, with focus on the compress() part?&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Happy New Year to the SAS community&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Dec 2014 21:32:40 GMT</pubDate>
    <dc:creator>ammarhm</dc:creator>
    <dc:date>2014-12-30T21:32:40Z</dc:date>
    <item>
      <title>Help deciphering this code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-deciphering-this-code/m-p/166042#M43037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;A short question&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working through a code that I am trying to understand and modify&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;SPAN class="s1"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;select&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;distinct&lt;/SPAN&gt; Var1, &lt;/P&gt;&lt;P class="p2"&gt;compress(put&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;(sum(Var2),&lt;/SPAN&gt;&lt;SPAN class="s3" style="font-size: 10pt; line-height: 1.5em;"&gt;comma7.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;||&lt;/SPAN&gt;&lt;SPAN class="s4" style="font-size: 10pt; line-height: 1.5em;"&gt;"/"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;|| &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;put(sum(Var3),&lt;/SPAN&gt;&lt;SPAN class="s3" style="font-size: 10pt; line-height: 1.5em;"&gt;comma12.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;from&lt;SPAN class="s1"&gt; x&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s2"&gt;group&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;by&lt;/SPAN&gt; Var1;&lt;/P&gt;&lt;P class="p1"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;SPAN class="s1"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Could anyone please explain in simple wording what this code is doing, with focus on the compress() part?&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Happy New Year to the SAS community&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Dec 2014 21:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-deciphering-this-code/m-p/166042#M43037</guid>
      <dc:creator>ammarhm</dc:creator>
      <dc:date>2014-12-30T21:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help deciphering this code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-deciphering-this-code/m-p/166043#M43038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;distinct is not needed here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We aggregate (take the sum) of Var2 and Var3. We convert both numbers to character strings with the commaW. format, then we concatenate those 2 character strings but also place a "/" between them.&lt;/P&gt;&lt;P&gt;We use the compress function to remove blanks from this concatenated string. For example converting a number to string with the comma12. format can result in a sting: &lt;STRONG&gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123,4"&lt;/STRONG&gt;. We need to remove the extra blanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the end result is: to summary numbers separated with a slash.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Dec 2014 21:48:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-deciphering-this-code/m-p/166043#M43038</guid>
      <dc:creator>gergely_batho</dc:creator>
      <dc:date>2014-12-30T21:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help deciphering this code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-deciphering-this-code/m-p/166044#M43039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Remove the compress to see what it's doing &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hint: Spaces, RTM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is taking the sum of var2, formatted to comma7 concatenating it to the sum of var3 formatted to comma12, separated by a slash. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Dec 2014 21:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-deciphering-this-code/m-p/166044#M43039</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-12-30T21:49:40Z</dc:date>
    </item>
  </channel>
</rss>

