<?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: How to recall a macro that holds a numeric value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593057#M170136</link>
    <description>&lt;P&gt;First check that the dataset variable PRODCOST is actually numeric.&amp;nbsp; Then check whether PRODCOST has any FORMAT attached to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can change the SELECT statement to remove the format (or convert to a better format) so that the generated macro variable is in a form that is valid in SAS code.&amp;nbsp; You can change the %PUT statement to make it clearer if there are any leading/trailing spaces in the macro variable's value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select prodname
     , prodcost format=best32.
 into :prodname trimmed
    , :prodcost trimmed
 from procsql.products
;
quit;

%put prodname=|&amp;amp;prodname| and prodcost=|&amp;amp;prodcost|;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For you character variable you might want to use the QUOTE() function to add the surrounding quotes into the macro variable and then you can remove them from your query that references to macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select quote(trim(prodname))
     , prodcost format=best32.
 into :prodname trimmed
    , :prodcost trimmed
 from procsql.products
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 01 Oct 2019 14:54:46 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-10-01T14:54:46Z</dc:date>
    <item>
      <title>How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/592543#M169912</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling to pass a numeric value through a sas macro.&amp;nbsp;&amp;nbsp;Program1 generates two macros, prodname and prodcost. Program2 filters the data by using the character value that we have stored through program1- this program is working fine. Program3 is intended to filter the data by using the numeric value that we have stores through program2- this program is not working. details of the programs are provided below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Program1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;select prodname, prodcost&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;into: prodname, : prodcost&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;from procsql.products;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%put &amp;amp;prodname and &amp;amp;prodcost;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I want to use the macro&amp;nbsp;(prodname) that recalls the character value, works perfectly fine. the following program runs perfectly fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Program2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp;select prodname, prodcost&lt;BR /&gt;&amp;nbsp;from procsql.products&lt;BR /&gt;&amp;nbsp;where prodname = "&amp;amp;prodname";&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Program3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I use the same program to recall the macro that holds the numeric values, it throws me an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;select prodname, prodcost&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;from procsql.products&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;where prodcost &amp;gt; &amp;amp;prodcost;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the log shows the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;&lt;U&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,&lt;/U&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;U&gt;a missing value, BTRIM, INPUT, PUT, SUBSTRING, USER.&lt;/U&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;Any help would be appreciated.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 03:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/592543#M169912</guid>
      <dc:creator>awais</dc:creator>
      <dc:date>2019-09-30T03:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593043#M170129</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/263167"&gt;@awais&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please specify what does the macro variable &amp;amp;prodcost look like when you run: &amp;nbsp;&lt;FONT face="andale mono,times"&gt;%put&amp;nbsp;&amp;amp;prodcost;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;For example, are there some leading / trailing blanks in addition to the stored number?&lt;/P&gt;&lt;P&gt;If so, I would suggest to use the a function like trim(&amp;amp;prodcost) to help SAS convert automatically the character value to a numeric one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this help!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593043#M170129</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-10-01T14:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593045#M170130</link>
      <description>&lt;P&gt;In addition the what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt;&amp;nbsp;said, &amp;amp;prodcost may have many values, such as 2.79 0.66 14.08, since PROCSQL.PRODUCTS probably contains many records, so its not really clear what you are trying to do in the case of many records. So, yes, I agree we need to see the contents of &amp;amp;prodcost.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593045#M170130</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-01T14:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593047#M170131</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/263167"&gt;@awais&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please specify what does the macro variable &amp;amp;prodcost look like when you run: &amp;nbsp;&lt;FONT face="andale mono,times"&gt;%put&amp;nbsp;&amp;amp;prodcost;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;For example, are there some leading / trailing blanks in addition to the stored number?&lt;/P&gt;
&lt;P&gt;If so, I would suggest to use the a function like trim(&amp;amp;prodcost) to help SAS convert automatically the character value to a numeric one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The function trim removes trailing whitspace only, all macro variables are always character, but because sas-macros exist to create sas-code, which is text, this is hardly a problem at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I fully support your request that &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/263167"&gt;@awais&lt;/a&gt; needs to show the result of the %put-statement. And,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/263167"&gt;@awais&lt;/a&gt;, please use the {i}-button and paste the excerpt of the sas log in that window, so that formatting is preserved.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593047#M170131</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-10-01T14:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593057#M170136</link>
      <description>&lt;P&gt;First check that the dataset variable PRODCOST is actually numeric.&amp;nbsp; Then check whether PRODCOST has any FORMAT attached to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can change the SELECT statement to remove the format (or convert to a better format) so that the generated macro variable is in a form that is valid in SAS code.&amp;nbsp; You can change the %PUT statement to make it clearer if there are any leading/trailing spaces in the macro variable's value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select prodname
     , prodcost format=best32.
 into :prodname trimmed
    , :prodcost trimmed
 from procsql.products
;
quit;

%put prodname=|&amp;amp;prodname| and prodcost=|&amp;amp;prodcost|;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For you character variable you might want to use the QUOTE() function to add the surrounding quotes into the macro variable and then you can remove them from your query that references to macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select quote(trim(prodname))
     , prodcost format=best32.
 into :prodname trimmed
    , :prodcost trimmed
 from procsql.products
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593057#M170136</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-01T14:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593058#M170137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/263167"&gt;@awais&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that there's a &lt;EM&gt;format&lt;/EM&gt; associated with variable &lt;FONT face="courier new,courier"&gt;prodcost&lt;/FONT&gt; in dataset&amp;nbsp;&lt;FONT face="courier new,courier"&gt;procsql.products&lt;/FONT&gt; and that you expect SAS to use the &lt;EM&gt;internal&lt;/EM&gt; numeric value in your WHERE statement. But macro variables contain only&amp;nbsp;&lt;EM&gt;text&lt;/EM&gt;, in this case the &lt;EM&gt;formatted&lt;/EM&gt; value of &lt;FONT face="courier new,courier"&gt;prodcost&lt;/FONT&gt; and there is no way to reconstruct the unformatted value from the macro variable alone. So, the solution would be to use a format (temporarily, in the PROC SQL step populating the macro variable) such that the formatted value is valid as a numeric literal (and, of course, is appropriate in terms of precision).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data products;
prodname='ABC';
prodcost=123.45;
format prodcost dollar8.2;
run;

proc sql noprint;
select prodname, prodcost format=best12.
into :prodname, :prodcost
from products;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:55:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/593058#M170137</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-10-01T14:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/594927#M171058</link>
      <description>&lt;P&gt;Hi thank you for replying. Here is the snapshot from log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter dijitContentPaneSingleChild"&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitAlignCenter dijitContentPaneSingleChild dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane"&gt;&lt;DIV class="tabs dijitBorderContainer dijitContainer dojoDndTarget sasStudioTabsParentContainer dijitLayoutContainer dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasStudioTabsTabContainer sasStudioTabsTabContainerVertical sasStudioTabsTop dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer sasStudioTabsTabContainerChild dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dojoDndTarget dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasSuiteTabs dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;%put &amp;amp;prodname and &amp;amp;prodcost;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Dream Machine and $3,200.00&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Oct 2019 01:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/594927#M171058</guid>
      <dc:creator>awais</dc:creator>
      <dc:date>2019-10-09T01:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/594928#M171059</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for replying. here is what I am seeing in the log&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter dijitContentPaneSingleChild"&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitAlignCenter dijitContentPaneSingleChild dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane"&gt;&lt;DIV class="tabs dijitBorderContainer dijitContainer dojoDndTarget sasStudioTabsParentContainer dijitLayoutContainer dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasStudioTabsTabContainer sasStudioTabsTabContainerVertical sasStudioTabsTop dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer sasStudioTabsTabContainerChild dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dojoDndTarget dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasSuiteTabs dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;%put &amp;amp;prodname and &amp;amp;prodcost;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Dream Machine and $3,200.00&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Oct 2019 01:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/594928#M171059</guid>
      <dc:creator>awais</dc:creator>
      <dc:date>2019-10-09T01:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/594955#M171076</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/263167"&gt;@awais&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you for replying. here is what I am seeing in the log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;
&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter dijitContentPaneSingleChild"&gt;
&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;
&lt;DIV class="dijitContentPane dijitAlignCenter dijitContentPaneSingleChild dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane"&gt;
&lt;DIV class="tabs dijitBorderContainer dijitContainer dojoDndTarget sasStudioTabsParentContainer dijitLayoutContainer dojoDndContainerOver"&gt;
&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasStudioTabsTabContainer sasStudioTabsTabContainerVertical sasStudioTabsTop dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;
&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;
&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;
&lt;DIV class="dijitBorderContainer dijitContainer sasStudioTabsTabContainerChild dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;
&lt;DIV class="dijitBorderContainer dijitContainer dojoDndTarget dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer dojoDndContainerOver"&gt;
&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasSuiteTabs dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;
&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;
&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;
&lt;DIV class="dijitBorderContainer dijitContainer dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;
&lt;DIV class="dijitBorderContainer dijitContainer dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer"&gt;
&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter"&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV class="sasSource"&gt;%put &amp;amp;prodname and &amp;amp;prodcost;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;Dream Machine and $3,200.00&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It looks like SAS variable prodcost from your table&amp;nbsp;procsql.products has a permanent format of DOLLARw.d attached.&lt;/P&gt;
&lt;P&gt;When creating macro variable &amp;amp;prodcost the formatted value gets used (which dollar sign, comma thousand separator). This then causes the error when you try to pass in this string as a numerical value to SAS (as there you can't use a dollar sign and comma separator unless you use such a string in an input function).&lt;/P&gt;
&lt;P&gt;May be just set an explicit format of 32. when creating the macro variable as done in below code sample for macro variable &amp;amp;PROD_COST2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  format prod_cost dollar16.2;
  prod_cost=320000;
  output;
  stop;
run;

proc sql;
  select 
    prod_cost, 
    prod_cost format=32.
      into 
        :prod_cost1 trimmed, 
        :prod_cost2 trimmed
  from sample
  ;
quit;

%put &amp;amp;=prod_cost1 &amp;amp;=prod_cost2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PROD_COST1=$320,000.00 PROD_COST2=320000&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2019 06:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/594955#M171076</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-09T06:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to recall a macro that holds a numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/595246#M171208</link>
      <description>&lt;P&gt;Hi Patric,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yeey. I got it working. you were right it had to do something with format of the macro variable. I modified the code as below and it is working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp;select prodname, prodcost format 32.&lt;BR /&gt;&amp;nbsp;into: prodname,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;: prodcost trimmed&lt;BR /&gt;&amp;nbsp;from procsql.products;&lt;BR /&gt;quit;&lt;BR /&gt;%put &amp;amp;prodname and &amp;amp;prodcost;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp;select prodname, prodcost&lt;BR /&gt;&amp;nbsp;from procsql.products&lt;BR /&gt;&amp;nbsp;where prodname = "&amp;amp;prodname";&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* Resolved now&amp;nbsp;*/&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp;select prodname, prodcost&lt;BR /&gt;&amp;nbsp;from procsql.products&lt;BR /&gt;&amp;nbsp;where prodcost &amp;gt; &amp;amp;prodcost;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 03:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-recall-a-macro-that-holds-a-numeric-value/m-p/595246#M171208</guid>
      <dc:creator>awais</dc:creator>
      <dc:date>2019-10-10T03:26:51Z</dc:date>
    </item>
  </channel>
</rss>

