<?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: Apply function to Macro Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Apply-function-to-Macro-Variable/m-p/470446#M285635</link>
    <description>&lt;P&gt;When using functions in a %LET you need to use %SYSFUNC() to tell SAS it's not text, but a function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dept = A B;

%let new_var = %sysfunc(compress(&amp;amp;dept));
%put &amp;amp;new_var;&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/140633"&gt;@tedway&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a macro variable and the value has a space in it. I want to keep this but also create a new variable that removes the space.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my example code:&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;%let var = A B;

%let new_var = compress(&amp;amp;dept);
%put &amp;amp;new_var;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This makes new_var equal to the string "compress(&amp;amp;dept)" but I want new_var to equal "AB."&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jun 2018 20:41:32 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-06-14T20:41:32Z</dc:date>
    <item>
      <title>Apply function to Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Apply-function-to-Macro-Variable/m-p/470441#M285634</link>
      <description>&lt;P&gt;I have a macro variable and the value has a space in it. I want to keep this but also create a new variable that removes the space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my example code:&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;%let var = A B;

%let new_var = compress(&amp;amp;dept);
%put &amp;amp;new_var;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This makes new_var equal to the string "compress(&amp;amp;dept)" but I want new_var to equal "AB."&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 20:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Apply-function-to-Macro-Variable/m-p/470441#M285634</guid>
      <dc:creator>tedway</dc:creator>
      <dc:date>2018-06-14T20:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Apply function to Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Apply-function-to-Macro-Variable/m-p/470446#M285635</link>
      <description>&lt;P&gt;When using functions in a %LET you need to use %SYSFUNC() to tell SAS it's not text, but a function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dept = A B;

%let new_var = %sysfunc(compress(&amp;amp;dept));
%put &amp;amp;new_var;&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/140633"&gt;@tedway&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a macro variable and the value has a space in it. I want to keep this but also create a new variable that removes the space.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my example code:&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;%let var = A B;

%let new_var = compress(&amp;amp;dept);
%put &amp;amp;new_var;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This makes new_var equal to the string "compress(&amp;amp;dept)" but I want new_var to equal "AB."&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 20:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Apply-function-to-Macro-Variable/m-p/470446#M285635</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-14T20:41:32Z</dc:date>
    </item>
  </channel>
</rss>

