<?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 capture the value of a variable in a macro variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63419#M13788</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;data _null_, I originally used the code that you suggested, and it worked. What didn't work is that I need to grab that single value and use it in a proc report as part of a calculation. Specifically, I need to calculate a new variable that uses this single value, along with the row sums that get calculated at proc report run time, within proc report. I am new to proc report and my code is evolving as I try to determine the best (i.e., most efficient in terms of processing time and efficient code) way to do create this report. Hence, in my question above I wanted to use the macro variable in a data step but realized it can and should be used in the proc report. Perhaps all of this could be done within proc report? I don't know yet. I am curious to know what makes using a macro variable bad technique in this case. &lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Using a macro variable as you describe implies you are not thinking about the problem properly.&amp;nbsp; I have a general run of thumb "don't put data into macro variables".&amp;nbsp; There are situations where data can go into macro variables but this isn't one them.&amp;nbsp; There is also a potential data loss issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for PROC REPORT if you could show an example that would be helpful.&amp;nbsp; I'm not good a guessing what you're thinking.&amp;nbsp; I doubt you will need a macro variable here either.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Sep 2011 16:10:09 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2011-09-13T16:10:09Z</dc:date>
    <item>
      <title>How to capture the value of a variable in a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63414#M13783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am computing a total using proc means and want to use this total, which is called xtot and is the sum of x, in my subsequent data step. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to do this without having to merge work.tot with test.second. Is this possible? As seen in the code below, I had the idea of achieving this using a global macro variable. The problem, of course, is that xtotl will resolve to 'xtot' not the value 5. I cannot apply the %eval function here either. I may have to resort to merging but want to know if it is possible to implement my idea of using global macro variables. I have some knowledge regarding SAS macros but am by no means an expert. All suggestions welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=test.first noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var x;&amp;nbsp; /* where x=5, for example */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output out=work.tot (drop=_type_ _freq_) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum (x)=xtot;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %global xtotl;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let xtotl=xtot;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data nextstep;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set test.second;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; totl=xtotl;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Sep 2011 15:40:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63414#M13783</guid>
      <dc:creator>npa</dc:creator>
      <dc:date>2011-09-12T15:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture the value of a variable in a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63415#M13784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you apparently only have one value for xtotl, you have a couple of options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The simplest, I think, is to skip proc means altogether and get your xtotl from proc sql, directly, as a macro variable.&amp;nbsp; You could do that with (or something very close to):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select sum(x) into :xtotl&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from test.first&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, the way you would refer to it in your datastep would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data nextstep;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set test.second;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; totl=&amp;amp;xtotl.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, there are also numerous other ways of accomplishing the same thing, like merging the output file from proc means together with test.second, or using a data _null_ step and call symput to create the macro variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Sep 2011 15:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63415#M13784</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-12T15:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture the value of a variable in a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63416#M13785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't use a macro variable for this, it is bad technique.&amp;nbsp; Use SET.&amp;nbsp; With SET there is no data loss and it is easy to include other statistics.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;means&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=sashelp.class &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;output&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=work.tot (drop=_type_ _freq_) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;(age)=xtot;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; sashelp.class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; _n_ eq &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; tot;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;STRONG style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;STRONG style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Sep 2011 17:09:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63416#M13785</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-09-12T17:09:35Z</dc:date>
    </item>
    <item>
      <title>How to capture the value of a variable in a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63417#M13786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=test.first noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var x;&amp;nbsp; /* where x=5, for example */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output out=work.tot (drop=_type_ _freq_)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum (x)=xtot;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;data _null_;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&amp;nbsp;&amp;nbsp; set tot;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&amp;nbsp;&amp;nbsp; call symputx('xtotl', xtot, 'G' );&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data nextstep;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set test.second;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; totl=xtotl;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Sep 2011 22:50:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63417#M13786</guid>
      <dc:creator>Fisher</dc:creator>
      <dc:date>2011-09-12T22:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture the value of a variable in a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63418#M13787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fisher, for whatever reason, I could not get the data _null_/call symputx solution to work. Xtotl was missing for all observations. Not being well-versed with the call symput/symputx function, I was not sure how to debug the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_, I originally used the code that you suggested, and it worked. What didn't work is that I need to grab that single value and use it in a proc report as part of a calculation. Specifically, I need to calculate a new variable that uses this single value, along with the row sums that get calculated at proc report run time, within proc report. I am new to proc report and my code is evolving as I try to determine the best (i.e., most efficient in terms of processing time and efficient code) way to do create this report. Hence, in my question above I wanted to use the macro variable in a data step but realized it can and should be used in the proc report. Perhaps all of this could be done within proc report? I don't know yet. I am curious to know what makes using a macro variable bad technique in this case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;art297, I was able to use the proc sql code successfully! Proc report (as well as a data step) recognized the macro variable and it resolved properly as shown in the log.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all of the above suggestions!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 15:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63418#M13787</guid>
      <dc:creator>npa</dc:creator>
      <dc:date>2011-09-13T15:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture the value of a variable in a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63419#M13788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;data _null_, I originally used the code that you suggested, and it worked. What didn't work is that I need to grab that single value and use it in a proc report as part of a calculation. Specifically, I need to calculate a new variable that uses this single value, along with the row sums that get calculated at proc report run time, within proc report. I am new to proc report and my code is evolving as I try to determine the best (i.e., most efficient in terms of processing time and efficient code) way to do create this report. Hence, in my question above I wanted to use the macro variable in a data step but realized it can and should be used in the proc report. Perhaps all of this could be done within proc report? I don't know yet. I am curious to know what makes using a macro variable bad technique in this case. &lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Using a macro variable as you describe implies you are not thinking about the problem properly.&amp;nbsp; I have a general run of thumb "don't put data into macro variables".&amp;nbsp; There are situations where data can go into macro variables but this isn't one them.&amp;nbsp; There is also a potential data loss issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for PROC REPORT if you could show an example that would be helpful.&amp;nbsp; I'm not good a guessing what you're thinking.&amp;nbsp; I doubt you will need a macro variable here either.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 16:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63419#M13788</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-09-13T16:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to capture the value of a variable in a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63420#M13789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do it all in one step, a SQL step. Not sure how big the data is, but this does the merge automatically:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table class as&lt;/P&gt;&lt;P&gt;select *, sum(age) as age_total&lt;/P&gt;&lt;P&gt;from sashelp.class;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*ONLY TO Check age total;&lt;/P&gt;&lt;P&gt;proc means data=sashelp.class n mean sum;&lt;/P&gt;&lt;P&gt;var age;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 16:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-capture-the-value-of-a-variable-in-a-macro-variable/m-p/63420#M13789</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-09-13T16:58:15Z</dc:date>
    </item>
  </channel>
</rss>

