<?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: Questions regarding macros used for proc format in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448673#M69609</link>
    <description>&lt;P&gt;You might look into creating a data set for use with the cntlin option to create formats.&lt;/P&gt;
&lt;P&gt;Your I parameter would be the FMTNAME, your J and K parameters would be used to create the LABEL and the values 1 and 2 would be Start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Mar 2018 15:22:41 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-26T15:22:41Z</dc:date>
    <item>
      <title>Questions regarding macros used for proc format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448659#M69607</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a macro for proc format as I&amp;nbsp;have many&amp;nbsp;variables that&amp;nbsp;can be formatted in similar matter. However, I&amp;nbsp;have 2 problems/questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Is there a way I could use&amp;nbsp;a comma in my macro without SAS&amp;nbsp;thinking it is an additional parameters?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro man_e(i,j,k);
	value &amp;amp;&amp;amp;i.
		1 = "&amp;amp;&amp;amp;j."
		2 = "Did not &amp;amp;&amp;amp;k.";
%mend;


%man_e(MAN,Appointed surviving spouse of X&lt;STRONG&gt;&lt;U&gt;,&lt;/U&gt;&lt;/STRONG&gt; of Y or of Z,appoint surviving spouse of X&lt;U&gt;&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;/U&gt; of Y or of Z);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Can I use an apostrophe in the macro? It would be very useful as a lot a apostrophe are used in French&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%man20_e(MAN_20Ae,au niveau d&lt;STRONG&gt;&lt;U&gt;'&lt;/U&gt;&lt;/STRONG&gt;entrée);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 15:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448659#M69607</guid>
      <dc:creator>Shawn08</dc:creator>
      <dc:date>2018-03-26T15:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Questions regarding macros used for proc format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448660#M69608</link>
      <description>&lt;P&gt;1. Sure you can do this, but I don't see how this is any less typing or any easier than typing PROC FORMAT for your cases without the macros. If you must have a comma, use the %str() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Look up the %STR and %NRSTR function in SAS, there are examples there of including apostrophe's in your macro&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 15:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448660#M69608</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-03-26T15:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Questions regarding macros used for proc format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448673#M69609</link>
      <description>&lt;P&gt;You might look into creating a data set for use with the cntlin option to create formats.&lt;/P&gt;
&lt;P&gt;Your I parameter would be the FMTNAME, your J and K parameters would be used to create the LABEL and the values 1 and 2 would be Start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 15:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448673#M69609</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-26T15:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Questions regarding macros used for proc format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448678#M69610</link>
      <description>&lt;P&gt;You should be able to solve both at once, by adding double-quotes when&amp;nbsp; you call the macro.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro man_e (i, j, k);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; value &amp;amp;i.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 = &amp;amp;j.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 = &amp;amp;k.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;/P&gt;
&lt;P&gt;%man_e (MAN, "Appointed surviving spouse of X, of Y or of Z", "Did not appoint surviving spouse of X, of Y or of Z")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That makes it more readable, and allows you to use commas and apostrophes, with one small downside.&amp;nbsp; You have to type the words "Did not" as part of the value of your third parameter.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 15:35:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448678#M69610</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-26T15:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Questions regarding macros used for proc format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448754#M69622</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/141055"&gt;@Shawn08&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a macro for proc format as I&amp;nbsp;have many&amp;nbsp;variables that&amp;nbsp;can be formatted in similar matter. However, I&amp;nbsp;have 2 problems/questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Is there a way I could use&amp;nbsp;a comma in my macro without SAS&amp;nbsp;thinking it is an additional parameters?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro man_e(i,j,k);
	value &amp;amp;&amp;amp;i.
		1 = "&amp;amp;&amp;amp;j."
		2 = "Did not &amp;amp;&amp;amp;k.";
%mend;


%man_e(MAN,Appointed surviving spouse of X&lt;STRONG&gt;&lt;U&gt;,&lt;/U&gt;&lt;/STRONG&gt; of Y or of Z,appoint surviving spouse of X&lt;U&gt;&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;/U&gt; of Y or of Z);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Can I use an apostrophe in the macro? It would be very useful as a lot a apostrophe are used in French&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%man20_e(MAN_20Ae,au niveau d&lt;STRONG&gt;&lt;U&gt;'&lt;/U&gt;&lt;/STRONG&gt;entrée);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I am not sure what you mean for (1) but if the issue is how to pass in a list of values then just use something other than comma as your delimiter.&amp;nbsp; For example you could use | as the delimiter.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro man_e(fmtname,values);
%local i ;
value &amp;amp;fmtname
%do i=1 %to %sysfunc(countw(&amp;amp;values,|));
  &amp;amp;i = %sysfunc(quote(&amp;amp;qscan(&amp;amp;values,&amp;amp;i,|)))
%end;
;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For (2) add quoting.&amp;nbsp; Either write the macro to expect a quoted string.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%man20_e(MAN_20Ae,"au niveau d'entrée");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or add macro quoting.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%man20_e(MAN_20Ae,%bquote(au niveau d'entrée));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Mar 2018 17:47:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Questions-regarding-macros-used-for-proc-format/m-p/448754#M69622</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-26T17:47:47Z</dc:date>
    </item>
  </channel>
</rss>

