<?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 empty space of all variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502050#M605</link>
    <description>&lt;P&gt;You can use _character_ to reference all character variables in an array and compress the spaces. Note that the spaces are determined by the length of the variable, so those spaces will still exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array _test(*) $ _character_;

do i=1 to dim(_test);
    _test(i) = compress(_test(i));
end;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144925"&gt;@Yegen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there any way to compress blank spaces of variable names of all variables without listing the variables individually?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Oct 2018 21:21:39 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-10-05T21:21:39Z</dc:date>
    <item>
      <title>Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502049#M604</link>
      <description>&lt;P&gt;Is there any way to compress blank spaces of variable names of all variables without listing the variables individually?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 21:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502049#M604</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2018-10-05T21:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502050#M605</link>
      <description>&lt;P&gt;You can use _character_ to reference all character variables in an array and compress the spaces. Note that the spaces are determined by the length of the variable, so those spaces will still exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array _test(*) $ _character_;

do i=1 to dim(_test);
    _test(i) = compress(_test(i));
end;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144925"&gt;@Yegen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there any way to compress blank spaces of variable names of all variables without listing the variables individually?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 21:21:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502050#M605</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-05T21:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502057#M606</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144925"&gt;@Yegen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there any way to compress blank spaces of variable names of all variables without listing the variables individually?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Spaces in variable &lt;STRONG&gt;names&lt;/STRONG&gt; or values of variables?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 22:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502057#M606</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-05T22:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502058#M607</link>
      <description>&lt;P&gt;Perfect thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 22:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502058#M607</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2018-10-05T22:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502059#M608</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;spaces in variable names.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The solution proposed by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;works well with character variables, but I am still facing issues with date variables. In particular, I have imported excel files (using a macro) and for some reason blank spaces were added to the variable names. I cannot identify the number of spaces even if I use a code as follows:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents
     data = work.temp_data
          noprint
          out = data_info
               (keep = name varnum);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 22:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502059#M608</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2018-10-05T22:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502063#M609</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;I have attached a few figures that might provide some hints with the error I am getting:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I am sorting the data by using the filter.&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2018-10-05 at 6.27.55 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23829iA71E2665E21C0297/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2018-10-05 at 6.27.55 PM.png" alt="Screen Shot 2018-10-05 at 6.27.55 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp;I am trying to edit the filter&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2018-10-05 at 6.28.14 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23830i6B650E4CF8D62162/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2018-10-05 at 6.28.14 PM.png" alt="Screen Shot 2018-10-05 at 6.28.14 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Now I am just re-running the same filter that SAS Studio gave me, but I am getting an error. &amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2018-10-05 at 6.28.27 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23831i60B2B328597DB390/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2018-10-05 at 6.28.27 PM.png" alt="Screen Shot 2018-10-05 at 6.28.27 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 22:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502063#M609</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2018-10-05T22:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502065#M610</link>
      <description>&lt;P&gt;Here is the data description:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2018-10-05 at 6.31.48 PM.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23832i7A4EF1FDE26309AB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2018-10-05 at 6.31.48 PM.png" alt="Screen Shot 2018-10-05 at 6.31.48 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 22:32:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502065#M610</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2018-10-05T22:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502066#M611</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144925"&gt;@Yegen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;spaces in variable names.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The solution proposed by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;works well with character variables, but I am still facing issues with date variables. In particular, I have imported excel files (using a macro) and for some reason blank spaces were added to the variable names. I cannot identify the number of spaces even if I use a code as follows:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents
     data = work.temp_data
          noprint
          out = data_info
               (keep = name varnum);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It sounds like you may have imported the data with the option validvarname set to "any".&lt;/P&gt;
&lt;P&gt;Run this code to see if that is the case:&lt;/P&gt;
&lt;PRE&gt;proc options option=validvarname;
run;&lt;/PRE&gt;
&lt;P&gt;If the LOG shows a result similar to&lt;/P&gt;
&lt;PRE&gt; VALIDVARNAME=ANY  Specifies the rules for valid SAS variable names that can be created and
                   processed during a SAS session.

&lt;/PRE&gt;
&lt;P&gt;then you can likely "fix" the problem by setting&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;option validvarname=V7;&lt;/P&gt;
&lt;P&gt;and reimporting.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 22:32:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502066#M611</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-05T22:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502067#M612</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;, this is the macro I was using to import the excel files:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro merging;
%do i=1 %to 8;


PROC IMPORT DATAFILE="/home/institution/user/SDC_M_A/sdc_oct5_&amp;amp;i..xlsx"
	DBMS=XLSX
	OUT=WORK.merging&amp;amp;i;
	GETNAMES=yes;
RUN;

%end;
%mend;
%merging;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;If I use your code, this is the log file I am getting:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;90         
 91         proc options option=validvarname;
 92         run;
 
     SAS (r) Proprietary Software Release 9.4  TS1M5
 
  VALIDVARNAME=ANY  Specifies the rules for valid SAS variable names that can be 
                    created and processed during a SAS session.
 NOTE: PROCEDURE OPTIONS used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 22:40:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502067#M612</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2018-10-05T22:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502068#M613</link>
      <description>&lt;P&gt;You are 100% right,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;. When I added the&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option validvarname=V7;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;statement in the macro the issue was fixed.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I assume the import function was just adding random blank spaces when you don't specify the validvarname?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 22:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502068#M613</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2018-10-05T22:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502072#M614</link>
      <description>&lt;P&gt;It’s usually not random, it’s likely in the excel file in some form.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 23:14:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502072#M614</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-05T23:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Compress empty space of all variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502150#M620</link>
      <description>&lt;P&gt;That makes sense, thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Oct 2018 17:29:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Compress-empty-space-of-all-variables/m-p/502150#M620</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2018-10-06T17:29:22Z</dc:date>
    </item>
  </channel>
</rss>

