<?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: compress date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800043#M314664</link>
    <description>&lt;P&gt;Dates are numbers.&amp;nbsp; COMPRESS() works on character strings.&lt;/P&gt;
&lt;P&gt;So to use COMPRESS() with a date value you would first need to convert it into a string.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code is using the PUT() function to convert date value generated by the INTNX() function into a character string using the display format specification of MONYY6.&amp;nbsp; &amp;nbsp;Since that will use 3 positions for the month abbreviation that leaves only 3 positions for the year.&amp;nbsp; SAS will truncate the year to just the last two digits by eliminate the century part.&amp;nbsp; This yield only 5 characters which will be right align in the 6 character string that is generated.&lt;/P&gt;
&lt;P&gt;You didn't tell COMPRESS() what characters to compress out of the string, so it will default to removing the spaces.&amp;nbsp; Thus the leading space will be removed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could eliminate the need for the COMPRESS() function by using MONYY5. format instead of MONYY6. since then there would be no leading space.&amp;nbsp; Or better still use the MONYY7. format and you will have room for all four digits of the year and you still wouldn't have any leading spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: Learn what the buttons on the tool bar that appears above the text box of the forum editor do.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-03-03 215400.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69130i8200BBA9C2E79A6B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-03-03 215400.jpg" alt="Screenshot 2022-03-03 215400.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Mar 2022 02:55:26 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-03-04T02:55:26Z</dc:date>
    <item>
      <title>compress date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800026#M314648</link>
      <description>&lt;P&gt;what would compressing a date give me? just removing any space around?&lt;/P&gt;&lt;P&gt;my command is as follows:&lt;/P&gt;&lt;P&gt;compress(put(intnx('month',"&amp;amp;perfdate."d,0,'end'),monyy6.))&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 01:23:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800026#M314648</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-04T01:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: compress date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800039#M314661</link>
      <description>&lt;P&gt;Have you tried it both with and without? The COMPRESS function should not make any difference here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, when you post code questions, please post complete statements and preferably program steps. Also use the "Insert SAS Code" menu option.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 02:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800039#M314661</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-03-04T02:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: compress date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800040#M314662</link>
      <description>on never see the "insert SAS code", where is it, will use going forwards&lt;BR /&gt;&lt;BR /&gt;you mean it is not removing the space or you mean even if the space is removed, it makes no diff to the end result</description>
      <pubDate>Fri, 04 Mar 2022 02:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800040#M314662</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-04T02:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: compress date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800043#M314664</link>
      <description>&lt;P&gt;Dates are numbers.&amp;nbsp; COMPRESS() works on character strings.&lt;/P&gt;
&lt;P&gt;So to use COMPRESS() with a date value you would first need to convert it into a string.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code is using the PUT() function to convert date value generated by the INTNX() function into a character string using the display format specification of MONYY6.&amp;nbsp; &amp;nbsp;Since that will use 3 positions for the month abbreviation that leaves only 3 positions for the year.&amp;nbsp; SAS will truncate the year to just the last two digits by eliminate the century part.&amp;nbsp; This yield only 5 characters which will be right align in the 6 character string that is generated.&lt;/P&gt;
&lt;P&gt;You didn't tell COMPRESS() what characters to compress out of the string, so it will default to removing the spaces.&amp;nbsp; Thus the leading space will be removed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could eliminate the need for the COMPRESS() function by using MONYY5. format instead of MONYY6. since then there would be no leading space.&amp;nbsp; Or better still use the MONYY7. format and you will have room for all four digits of the year and you still wouldn't have any leading spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: Learn what the buttons on the tool bar that appears above the text box of the forum editor do.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-03-03 215400.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69130i8200BBA9C2E79A6B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-03-03 215400.jpg" alt="Screenshot 2022-03-03 215400.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 02:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800043#M314664</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-04T02:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: compress date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800071#M314682</link>
      <description>&lt;P&gt;The indicated button has to be used for logs and textual data where it is necessary that the horizontal spacing is kept and no characters are changed. The "little running man" right next to it is meant for posting SAS code, as it additionally provides coloring similar to the SAS Enhanced Editor.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 06:05:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/compress-date/m-p/800071#M314682</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-04T06:05:05Z</dc:date>
    </item>
  </channel>
</rss>

