<?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 variable in PROC FORMAT in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Macro-variable-in-PROC-FORMAT/m-p/48342#M13064</link>
    <description>reverse those quotes &lt;BR /&gt;
&amp;amp;macro_vars resolve inside doubles, but not single quotes (, at the outer level). So try&lt;BR /&gt;
value $tafmt 'X' = "X (n='&amp;amp;dA1')"&lt;BR /&gt;
'D' = "D (n='&amp;amp;dA2')";&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
However, this resolves the macro variables when proc format executes. Was that what you wanted?&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
    <pubDate>Thu, 28 Jan 2010 22:32:49 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2010-01-28T22:32:49Z</dc:date>
    <item>
      <title>Macro variable in PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-variable-in-PROC-FORMAT/m-p/48341#M13063</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
      select distinct(aN) into :dA1-:dA2 &lt;BR /&gt;
        from dasd&lt;BR /&gt;
      group by step;&lt;BR /&gt;
    quit;&lt;BR /&gt;
  &lt;BR /&gt;
    proc format;&lt;BR /&gt;
      value $tafmt 'X' = 'X (n="&amp;amp;dA1")'&lt;BR /&gt;
                      'D' = 'D (n="&amp;amp;dA2")';&lt;BR /&gt;
    run;&lt;BR /&gt;
&lt;BR /&gt;
If I attach  this format to the value, I'm getting X(n=&amp;amp;denomA1) .  The macro variable is not resolving.  I even tried giving everything in double quotes in PROC FORMAT.  &lt;BR /&gt;
&lt;BR /&gt;
Thanks in Advance,&lt;BR /&gt;
Sandy.</description>
      <pubDate>Thu, 28 Jan 2010 21:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-variable-in-PROC-FORMAT/m-p/48341#M13063</guid>
      <dc:creator>Sandhya</dc:creator>
      <dc:date>2010-01-28T21:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable in PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-variable-in-PROC-FORMAT/m-p/48342#M13064</link>
      <description>reverse those quotes &lt;BR /&gt;
&amp;amp;macro_vars resolve inside doubles, but not single quotes (, at the outer level). So try&lt;BR /&gt;
value $tafmt 'X' = "X (n='&amp;amp;dA1')"&lt;BR /&gt;
'D' = "D (n='&amp;amp;dA2')";&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
However, this resolves the macro variables when proc format executes. Was that what you wanted?&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Thu, 28 Jan 2010 22:32:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-variable-in-PROC-FORMAT/m-p/48342#M13064</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-01-28T22:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable in PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-variable-in-PROC-FORMAT/m-p/48343#M13065</link>
      <description>I agree with Peter.C -- best to explain how you intend to use this narrow focus example with PROC SQL to generate suitable data values for a PROC FORMAT code execution?&lt;BR /&gt;
&lt;BR /&gt;
Also, from my testing with the OP's code, either technique for coding the single or double quote yields the same format contents, so if you are getting "denom" there is some other problem with your code.&lt;BR /&gt;
&lt;BR /&gt;
Suggest you use the SAS command below to see what SAS macro variables have as values:&lt;BR /&gt;
&lt;BR /&gt;
%PUT _ALL_;&lt;BR /&gt;
&lt;BR /&gt;
..or..&lt;BR /&gt;
&lt;BR /&gt;
%PUT _GLOBAL_;&lt;BR /&gt;
&lt;BR /&gt;
..or..&lt;BR /&gt;
&lt;BR /&gt;
%PUT _LOCAL_;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Also, suggest you use the FMTLIB parameter with PROC FORMAT to see what's being generated as output to your format.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 29 Jan 2010 00:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-variable-in-PROC-FORMAT/m-p/48343#M13065</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-29T00:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable in PROC FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-variable-in-PROC-FORMAT/m-p/48344#M13066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i mimicked your code using the sashelp.class dataset like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select name into :name1-:name19 from sashelp.class;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above code will create the macro variables like name1,name2....; inorder to check if the macro variable is getting resolved in the format i created i used the fmtlib option, i found that it is not resolving and the reason for this is the syntax in the proc format value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc format fmtlib;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value $tafmt 'X' = 'X (n="&amp;amp;name1")';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the correct syntax would be as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format fmtlib;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value $tafmt 'x'="x(n=&amp;amp;name1)";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make sure that you put only once opening and closing quote for the label as "x(n=&amp;amp;name1)";. Hope this will be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Aug 2013 02:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-variable-in-PROC-FORMAT/m-p/48344#M13066</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-08-17T02:37:14Z</dc:date>
    </item>
  </channel>
</rss>

