<?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: asking the experts  /compress function in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/asking-the-experts-compress-function/m-p/442868#M28585</link>
    <description>&lt;P&gt;There is in SAS something called implicit conversion.&amp;nbsp; What this means is that if a variable type does not conform to the given required type, then SAS will try to convert the type from to the other, so numeric to text and vice versa.&amp;nbsp; In your case SAS is implicitly converting the number to a string and then performing the action.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my opinion this is quite bad practice, all conversions should be open and precise.&amp;nbsp; First it avoids questions like this, but also the conversion may not be to something you actually want.&amp;nbsp; Always use explicit conversions using put() and input().&amp;nbsp; Macro varaibles are always text hence no conversion needed there (and one reason why not to store data in them!).&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 13:15:58 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-03-06T13:15:58Z</dc:date>
    <item>
      <title>asking the experts  /compress function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/asking-the-experts-compress-function/m-p/442863#M28582</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found an old lock program for the company I work for (see below). They use the compression function with a numeric variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought the compression function should only be used with character variables. Maybe I'm wrong!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it a particular use of which I am not informed?&lt;/P&gt;&lt;P&gt;Please note that week, year and date are numerical variables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_ ;&lt;BR /&gt;set commun.dates (where = (date = date()));&lt;/P&gt;&lt;P&gt;if day = 2 then do;&lt;BR /&gt;call symput ("Monday",1);&lt;BR /&gt;call symput ("week",compress(week-1));&lt;BR /&gt;call symput ("current_week",compress(week));&lt;BR /&gt;call symput ("dt_Monday",date);&lt;BR /&gt;end;&lt;BR /&gt;else do;&lt;BR /&gt;call symput ("Monday",0);&lt;BR /&gt;call symput ("week",compress(week));&lt;BR /&gt;call symput ("current_week",compress(week));&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;call symput ("year",compress(year));&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 12:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/asking-the-experts-compress-function/m-p/442863#M28582</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-03-06T12:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: asking the experts  /compress function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/asking-the-experts-compress-function/m-p/442867#M28584</link>
      <description>&lt;P&gt;SAS will automatically convert numbers to character whenever numeric values are used where character is expected. The compress() function is needed to get rid of the blanks resulting from such automatic conversions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I personally do not tolerate automatic conversions in my programs.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 13:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/asking-the-experts-compress-function/m-p/442867#M28584</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-06T13:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: asking the experts  /compress function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/asking-the-experts-compress-function/m-p/442868#M28585</link>
      <description>&lt;P&gt;There is in SAS something called implicit conversion.&amp;nbsp; What this means is that if a variable type does not conform to the given required type, then SAS will try to convert the type from to the other, so numeric to text and vice versa.&amp;nbsp; In your case SAS is implicitly converting the number to a string and then performing the action.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my opinion this is quite bad practice, all conversions should be open and precise.&amp;nbsp; First it avoids questions like this, but also the conversion may not be to something you actually want.&amp;nbsp; Always use explicit conversions using put() and input().&amp;nbsp; Macro varaibles are always text hence no conversion needed there (and one reason why not to store data in them!).&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 13:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/asking-the-experts-compress-function/m-p/442868#M28585</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-03-06T13:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: asking the experts  /compress function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/asking-the-experts-compress-function/m-p/442873#M28587</link>
      <description>I agree with both you. Thanks for refering to implicit conversion.</description>
      <pubDate>Tue, 06 Mar 2018 13:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/asking-the-experts-compress-function/m-p/442873#M28587</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-03-06T13:35:53Z</dc:date>
    </item>
  </channel>
</rss>

