<?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: assigning a macro value with a format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/assigning-a-macro-value-with-a-format/m-p/938995#M368763</link>
    <description>proc format;&lt;BR /&gt;value $plan_type&lt;BR /&gt;'01'='HMO'&lt;BR /&gt;'02'='HMOPOS'&lt;BR /&gt;'04'='Local PPO'&lt;BR /&gt;'31'='Regional PPO'&lt;BR /&gt;;&lt;BR /&gt;</description>
    <pubDate>Mon, 12 Aug 2024 17:23:11 GMT</pubDate>
    <dc:creator>Batman</dc:creator>
    <dc:date>2024-08-12T17:23:11Z</dc:date>
    <item>
      <title>assigning a macro value with a format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assigning-a-macro-value-with-a-format/m-p/938991#M368759</link>
      <description>&lt;P&gt;Can I assign a macro value with a format.&amp;nbsp; &amp;nbsp;I'm able to do it in a data step, but similar code doesn't seem to work with a macro value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;27 /*value is correctly assigned in data step*/&lt;BR /&gt;28 data _null_;&lt;BR /&gt;29 y=put('01',$plan_type.);&lt;BR /&gt;30 put y;&lt;BR /&gt;31 run;&lt;/P&gt;&lt;P&gt;HMO&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.15 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;31 !&lt;/P&gt;&lt;P&gt;32&lt;BR /&gt;33 /*Doesn't work for macro value*/&lt;BR /&gt;34 %let grp=%sysfunc(putc('01',$plan_type.));&lt;BR /&gt;35 %put &amp;amp;grp;&lt;BR /&gt;'01'&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 17:03:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assigning-a-macro-value-with-a-format/m-p/938991#M368759</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2024-08-12T17:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: assigning a macro value with a format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assigning-a-macro-value-with-a-format/m-p/938994#M368762</link>
      <description>&lt;P&gt;Show us the definition of the format $PLAN_TYPE.&lt;/P&gt;
&lt;P&gt;Does it actually include decodes for both of those values you tried?&lt;/P&gt;
&lt;P&gt;In the data step you asked it to decode the two character string: 01.&amp;nbsp; In the macro code you asked it do decode the four character string '01'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try it passing just the string 01 in the macro code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let grp=%sysfunc(putc(01,$plan_type.));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Aug 2024 17:20:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assigning-a-macro-value-with-a-format/m-p/938994#M368762</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-12T17:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: assigning a macro value with a format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assigning-a-macro-value-with-a-format/m-p/938995#M368763</link>
      <description>proc format;&lt;BR /&gt;value $plan_type&lt;BR /&gt;'01'='HMO'&lt;BR /&gt;'02'='HMOPOS'&lt;BR /&gt;'04'='Local PPO'&lt;BR /&gt;'31'='Regional PPO'&lt;BR /&gt;;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Aug 2024 17:23:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assigning-a-macro-value-with-a-format/m-p/938995#M368763</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2024-08-12T17:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: assigning a macro value with a format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assigning-a-macro-value-with-a-format/m-p/938998#M368766</link>
      <description>&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;%let grp=%sysfunc(putc(01,$plan_type.));
%put &amp;amp;=grp;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't put quotes around 01 as you did originally, because in %sysfunc, everything is considered text and so quotes are considered text and not the demarcation of text. Thus '01' is a four character text string that does not match any of your format levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With regard to this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $plan_type
'01'='HMO'
'02'='HMOPOS'
'04'='Local PPO'
'31'='Regional PPO'
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do yourself a favor and do us a favor and end all PROCs with a &lt;FONT face="courier new,courier"&gt;RUN;&lt;/FONT&gt; statement. And as mentioned above, show us all relevant parts of the code in your original post, don't leave relevant parts out.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 17:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assigning-a-macro-value-with-a-format/m-p/938998#M368766</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-08-12T17:32:26Z</dc:date>
    </item>
  </channel>
</rss>

