<?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 Return String with &amp;quot;%&amp;quot; in Proc FCMP in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Return-String-with-quot-quot-in-Proc-FCMP/m-p/537467#M74004</link>
    <description>&lt;P&gt;I am trying to build a function in SAS that will concatenate and number and a percent value and return a character string result like X (Y%). Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc fcmp outlib = func.funcs.mwfunc;
	/* Create function to return a string in the style X (Y%) */
	function npct(n, pct) $ 25;
		length concatp $25 n pct 8;
		n_f = n;
		pct_f = pct;
		concatp = cat(n_f, " (", round(pct_f*100,0.01),"%",")");
		return(concatp);
	endsub;
quit;

/* Test function */
data _null_;
	x = npct(5,0.10);
	put x;
run;&lt;/PRE&gt;&lt;P&gt;When I test this function, it produces the following result:&lt;/P&gt;&lt;P&gt;5 (10=)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of 5 (10%).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I correct this? Is there some kind of masking function I need?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help. I am working in SAS 9.4.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Feb 2019 17:18:45 GMT</pubDate>
    <dc:creator>Martha</dc:creator>
    <dc:date>2019-02-21T17:18:45Z</dc:date>
    <item>
      <title>Return String with "%" in Proc FCMP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Return-String-with-quot-quot-in-Proc-FCMP/m-p/537467#M74004</link>
      <description>&lt;P&gt;I am trying to build a function in SAS that will concatenate and number and a percent value and return a character string result like X (Y%). Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc fcmp outlib = func.funcs.mwfunc;
	/* Create function to return a string in the style X (Y%) */
	function npct(n, pct) $ 25;
		length concatp $25 n pct 8;
		n_f = n;
		pct_f = pct;
		concatp = cat(n_f, " (", round(pct_f*100,0.01),"%",")");
		return(concatp);
	endsub;
quit;

/* Test function */
data _null_;
	x = npct(5,0.10);
	put x;
run;&lt;/PRE&gt;&lt;P&gt;When I test this function, it produces the following result:&lt;/P&gt;&lt;P&gt;5 (10=)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of 5 (10%).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I correct this? Is there some kind of masking function I need?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help. I am working in SAS 9.4.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 17:18:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Return-String-with-quot-quot-in-Proc-FCMP/m-p/537467#M74004</guid>
      <dc:creator>Martha</dc:creator>
      <dc:date>2019-02-21T17:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Return String with "%" in Proc FCMP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Return-String-with-quot-quot-in-Proc-FCMP/m-p/537470#M74005</link>
      <description>&lt;P&gt;Just use single quotes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'%'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in your function definition.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 17:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Return-String-with-quot-quot-in-Proc-FCMP/m-p/537470#M74005</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-02-21T17:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Return String with "%" in Proc FCMP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Return-String-with-quot-quot-in-Proc-FCMP/m-p/537474#M74006</link>
      <description>&lt;P&gt;Thank you, that was way easier than I anticipated!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 17:26:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Return-String-with-quot-quot-in-Proc-FCMP/m-p/537474#M74006</guid>
      <dc:creator>Martha</dc:creator>
      <dc:date>2019-02-21T17:26:58Z</dc:date>
    </item>
  </channel>
</rss>

