<?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: macro keyword parameter resolve problem in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/macro-keyword-parameter-resolve-problem/m-p/616512#M18919</link>
    <description>&lt;P&gt;First, there is rarely ever a reason to enclose the values of macro variables in quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%createdata(n=10,word='123456789');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%createdata(n=10,word=123456789)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, you still have a problem here. You state "&lt;SPAN&gt;In the second part, I got the result, but string='5'... "&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You do not get string='5'. You get string=5. (If you fix it the way &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/180206"&gt;@JeffMaggio&lt;/a&gt;&amp;nbsp;or I suggest, you get string=6.) In other words string is numeric. Is that what you want?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jan 2020 15:35:35 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-01-10T15:35:35Z</dc:date>
    <item>
      <title>macro keyword parameter resolve problem</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-keyword-parameter-resolve-problem/m-p/616281#M18875</link>
      <description>&lt;P&gt;Hi guys. This is my code, I want to substring the "word" value but the first part of the code cannot work, seems like word resolve into:123456789'. But I don't understand the mechanism behind it?&lt;/P&gt;&lt;P&gt;In the second part, I got the result, but string='5', why it's not '6' when I use the sixth position inside the %substr function?&lt;/P&gt;&lt;PRE&gt;/********************&lt;CODE class=" language-sas"&gt;first part***********************/&lt;BR /&gt;%macro createdata(n=,word=);
%do i=1 %to &amp;amp;n;
data data&amp;amp;i;
%if &amp;amp;i&amp;gt;5 %then string=%substr(&amp;amp;word,6);
run;
%end;
%mend;
%createdata(n=10,word='123456789');&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/********************second part***********************/
%macro createdata(n=,word=);
%do i=1 %to &amp;amp;n;
data data&amp;amp;i;
%if &amp;amp;i&amp;gt;5 %then string=%substr(&amp;amp;word,6,1);;
run;
%end;
%mend;
%createdata(n=10,word='123456789');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Jan 2020 18:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-keyword-parameter-resolve-problem/m-p/616281#M18875</guid>
      <dc:creator>shawn123</dc:creator>
      <dc:date>2020-01-09T18:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: macro keyword parameter resolve problem</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-keyword-parameter-resolve-problem/m-p/616508#M18917</link>
      <description>&lt;P&gt;The first character in your string is '&lt;BR /&gt;the second character is 1&lt;BR /&gt;...&lt;/P&gt;&lt;P&gt;The 6th character is 5&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 15:25:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-keyword-parameter-resolve-problem/m-p/616508#M18917</guid>
      <dc:creator>JeffMaggio</dc:creator>
      <dc:date>2020-01-10T15:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: macro keyword parameter resolve problem</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-keyword-parameter-resolve-problem/m-p/616512#M18919</link>
      <description>&lt;P&gt;First, there is rarely ever a reason to enclose the values of macro variables in quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%createdata(n=10,word='123456789');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%createdata(n=10,word=123456789)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, you still have a problem here. You state "&lt;SPAN&gt;In the second part, I got the result, but string='5'... "&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You do not get string='5'. You get string=5. (If you fix it the way &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/180206"&gt;@JeffMaggio&lt;/a&gt;&amp;nbsp;or I suggest, you get string=6.) In other words string is numeric. Is that what you want?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 15:35:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-keyword-parameter-resolve-problem/m-p/616512#M18919</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-10T15:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: macro keyword parameter resolve problem</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-keyword-parameter-resolve-problem/m-p/616663#M18943</link>
      <description>THANK YOU SO MUCH!</description>
      <pubDate>Sat, 11 Jan 2020 05:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-keyword-parameter-resolve-problem/m-p/616663#M18943</guid>
      <dc:creator>shawn123</dc:creator>
      <dc:date>2020-01-11T05:24:50Z</dc:date>
    </item>
  </channel>
</rss>

