<?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: PUTN in %SYSFUNC: What's the Problem? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PUTN-in-SYSFUNC-What-s-the-Problem/m-p/510931#M137500</link>
    <description>&lt;P&gt;No quotes in the z4 in the last one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In macro language all quotes are dropped in literals. I think it’s because of how the macro processor works and it parses it all as text unless specified otherwise.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/wp-content/uploads/2016/02/bt185.pdf" target="_blank"&gt;https://stats.idre.ucla.edu/wp-content/uploads/2016/02/bt185.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More generally, it’s a rule In macro language, docs:&lt;/P&gt;
&lt;DIV id="n0f3m6c5gqm868n1mn6ley2exydf" class="xis-paragraph"&gt;Because %SYSFUNC is a macro function, you do not need to enclose character values in quotation marks as you do in DATA step functions. For example, the arguments to the OPEN function are enclosed in quotation marks when the function is used alone, but do not require quotation marks when used within %SYSFUNC()...&lt;/DIV&gt;
&lt;DIV class="xis-listUnordered"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1o13d7wb2zfcnn19s5ssl2zdxvi.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#" target="_blank"&gt;https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1o13d7wb2zfcnn19s5ssl2zdxvi.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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/173881"&gt;@Junyong&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The code below must do the same thing in three different ways using the DATA step, SAS/IML, and SAS Macro, respectively, but unfortunately the third one doesn't work and&amp;nbsp;just produces some warning messages saying "&lt;FONT face="courier new,courier"&gt;WARNING: Argument 2 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.&lt;/FONT&gt;"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	do I=1 to 10;
		J=putn(I,"z4.");
		put J;
	end;
run;

proc iml;
	file log;
	do I=1 to 10;
		J=putn(I,"z4.");
		put J;
	end;
	closefile log;
quit;

%macro REPEAT;
	%do I=1 %to 10;
		%let J=%sysfunc(putn(&amp;amp;I.,"z4."));
		%put &amp;amp;J.;
	%end;
%mend;
%REPEAT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I just realized that, unlike the rest cases, I should&amp;nbsp;drop the&amp;nbsp;double quotation marks around &lt;FONT face="courier new,courier"&gt;z4.&lt;/FONT&gt; in the PUTN, but I can't understand why the quotation marks, which are necessary for the rest cases, must be&amp;nbsp;suppressed here.&amp;nbsp;Why do they have different grammatical rules?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Nov 2018 01:14:59 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-11-07T01:14:59Z</dc:date>
    <item>
      <title>PUTN in %SYSFUNC: What's the Problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTN-in-SYSFUNC-What-s-the-Problem/m-p/510925#M137499</link>
      <description>&lt;P&gt;The code below must do the same thing in three different ways using the DATA step, SAS/IML, and SAS Macro, respectively, but unfortunately the third one doesn't work and&amp;nbsp;just produces some warning messages saying "&lt;FONT face="courier new,courier"&gt;WARNING: Argument 2 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.&lt;/FONT&gt;"&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	do I=1 to 10;
		J=putn(I,"z4.");
		put J;
	end;
run;

proc iml;
	file log;
	do I=1 to 10;
		J=putn(I,"z4.");
		put J;
	end;
	closefile log;
quit;

%macro REPEAT;
	%do I=1 %to 10;
		%let J=%sysfunc(putn(&amp;amp;I.,"z4."));
		%put &amp;amp;J.;
	%end;
%mend;
%REPEAT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I just realized that, unlike the rest cases, I should&amp;nbsp;drop the&amp;nbsp;double quotation marks around &lt;FONT face="courier new,courier"&gt;z4.&lt;/FONT&gt; in the PUTN, but I can't understand why the quotation marks, which are necessary for the rest cases, must be&amp;nbsp;suppressed here.&amp;nbsp;Why do they have different grammatical rules?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 00:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTN-in-SYSFUNC-What-s-the-Problem/m-p/510925#M137499</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2018-11-07T00:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: PUTN in %SYSFUNC: What's the Problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTN-in-SYSFUNC-What-s-the-Problem/m-p/510931#M137500</link>
      <description>&lt;P&gt;No quotes in the z4 in the last one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In macro language all quotes are dropped in literals. I think it’s because of how the macro processor works and it parses it all as text unless specified otherwise.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/wp-content/uploads/2016/02/bt185.pdf" target="_blank"&gt;https://stats.idre.ucla.edu/wp-content/uploads/2016/02/bt185.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More generally, it’s a rule In macro language, docs:&lt;/P&gt;
&lt;DIV id="n0f3m6c5gqm868n1mn6ley2exydf" class="xis-paragraph"&gt;Because %SYSFUNC is a macro function, you do not need to enclose character values in quotation marks as you do in DATA step functions. For example, the arguments to the OPEN function are enclosed in quotation marks when the function is used alone, but do not require quotation marks when used within %SYSFUNC()...&lt;/DIV&gt;
&lt;DIV class="xis-listUnordered"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1o13d7wb2zfcnn19s5ssl2zdxvi.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#" target="_blank"&gt;https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1o13d7wb2zfcnn19s5ssl2zdxvi.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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/173881"&gt;@Junyong&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The code below must do the same thing in three different ways using the DATA step, SAS/IML, and SAS Macro, respectively, but unfortunately the third one doesn't work and&amp;nbsp;just produces some warning messages saying "&lt;FONT face="courier new,courier"&gt;WARNING: Argument 2 to function PUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.&lt;/FONT&gt;"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	do I=1 to 10;
		J=putn(I,"z4.");
		put J;
	end;
run;

proc iml;
	file log;
	do I=1 to 10;
		J=putn(I,"z4.");
		put J;
	end;
	closefile log;
quit;

%macro REPEAT;
	%do I=1 %to 10;
		%let J=%sysfunc(putn(&amp;amp;I.,"z4."));
		%put &amp;amp;J.;
	%end;
%mend;
%REPEAT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I just realized that, unlike the rest cases, I should&amp;nbsp;drop the&amp;nbsp;double quotation marks around &lt;FONT face="courier new,courier"&gt;z4.&lt;/FONT&gt; in the PUTN, but I can't understand why the quotation marks, which are necessary for the rest cases, must be&amp;nbsp;suppressed here.&amp;nbsp;Why do they have different grammatical rules?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 01:14:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTN-in-SYSFUNC-What-s-the-Problem/m-p/510931#M137500</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-07T01:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: PUTN in %SYSFUNC: What's the Problem?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTN-in-SYSFUNC-What-s-the-Problem/m-p/510933#M137501</link>
      <description>&lt;P&gt;the answer to your question is best understood by reviewing how tokenisation o&lt;STRONG&gt;f &lt;U&gt;literal tokens&lt;/U&gt;&lt;/STRONG&gt; and &lt;STRONG&gt;&lt;U&gt;special tokens&lt;/U&gt; &lt;/STRONG&gt;work at compile time and what tokens are sent to compiler for datastep execution&lt;/P&gt;
&lt;P&gt;Doesn't take too long to grasp as that's mostly common to many programming languages. hth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 01:24:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTN-in-SYSFUNC-What-s-the-Problem/m-p/510933#M137501</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-07T01:24:13Z</dc:date>
    </item>
  </channel>
</rss>

