<?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: How to output a part of a macro variable into another macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578267#M163971</link>
    <description>&lt;P&gt;You must be getting error messages with this code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about you look at them and take the appropriate action to address the issues they raise?&lt;/P&gt;</description>
    <pubDate>Thu, 01 Aug 2019 04:48:30 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2019-08-01T04:48:30Z</dc:date>
    <item>
      <title>How to output a part of a macro variable into another macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578265#M163969</link>
      <description>&lt;P&gt;Dear&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to split a macro variable value into two macro variables. For this statement i am expecting aaaa+ for first obs . But i am getting "substrn(aaaa+bbbbb,1,find(aaaa+bbbbb,'+'))".&amp;nbsp; &amp;nbsp;Please suggest.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input a $10.;
datalines;
aaaa+bbbbb
cccc+ddddd
;

%global treat1 treat2;
proc sql noprint;
    select strip(put(count (distinct a), best.)) into: cnt from one;
 select distinct a into :treat1 -:treat&amp;amp;cnt. from one
 order by a;
quit;

%global treatt11; 

%let treatt11=%substrn(&amp;amp;treat1.,1,find(&amp;amp;treat1.,'+'));

%put &amp;amp;treatt11.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Aug 2019 04:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578265#M163969</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2019-08-01T04:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to output a part of a macro variable into another macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578267#M163971</link>
      <description>&lt;P&gt;You must be getting error messages with this code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about you look at them and take the appropriate action to address the issues they raise?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 04:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578267#M163971</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-08-01T04:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to output a part of a macro variable into another macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578268#M163972</link>
      <description>&lt;P&gt;Hint: The result you want is similar to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql noprint;
  select count(distinct A) into: cnt from ONE;
  select distinct A into :treat1 - from ONE order by A;
quit;

%let treatt11=%scan(&amp;amp;treat1,1,+);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Aug 2019 04:55:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578268#M163972</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-08-01T04:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to output a part of a macro variable into another macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578269#M163973</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68272"&gt;@knveraraju91&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Dear&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to split a macro variable value into two macro variables. For this statement i am expecting aaaa+ for first obs . But i am getting "substrn(aaaa+bbbbb,1,find(aaaa+bbbbb,'+'))".&amp;nbsp; &amp;nbsp;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is a perfect example of the nature of the sas macro language: everything is text. If you want to execute data step functions in macro code, than you have to wrap &lt;STRONG&gt;each&lt;/STRONG&gt; function-call in %sysfunc(function(....)). Or use one of the macro-functions as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt; suggested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 04:59:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578269#M163973</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-08-01T04:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to output a part of a macro variable into another macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578271#M163975</link>
      <description>&lt;P&gt;This construct alone:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    select strip(put(count (distinct a), best.)) into: cnt from one;
 select distinct a into :treat1 -:treat&amp;amp;cnt. from one
 order by a;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is a clear sign of the abuse of the macro processor for data handling. DATA needs to be kept in DATAsets and manipulated with DATA steps and the other tools of the Base SAS language. The use of such macro list is (with a probability of 99.9 %) a design failure. Forget your unhealthy macro obsession and use the proper tools. See Maxims 11,14, 7,8,9, and 1.&lt;/P&gt;
&lt;P&gt;Dynamic code can simply be created out of your dataset with call execute, no macro variable lists necessary. NOT NECESSARY.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 05:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578271#M163975</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-01T05:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to output a part of a macro variable into another macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578275#M163976</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data two;
set one;
treat = cats(scan(a,1,'+'),'+');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then do whatever you need to do out of dataset two.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 06:02:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-a-part-of-a-macro-variable-into-another-macro/m-p/578275#M163976</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-01T06:02:13Z</dc:date>
    </item>
  </channel>
</rss>

