<?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: Creating a macro variable for use in future calculation in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-variable-for-use-in-future-calculation/m-p/5282#M1674</link>
    <description>Your best choice is using SAS Macro variables. This is just one example. There are other ways of creating macro variables.&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select nobs into :cntobs&lt;BR /&gt;
  from dictionary.tables&lt;BR /&gt;
  where libname = "SASHELP" and&lt;BR /&gt;
        memname = "CLASS";&lt;BR /&gt;
quit;&lt;BR /&gt;
     &lt;BR /&gt;
%let cntobs = &amp;amp;cntobs;&lt;BR /&gt;
%put cntobs= &amp;amp;cntobs is the number of obs in SASHELP.CLASS;&lt;BR /&gt;
     &lt;BR /&gt;
data new;&lt;BR /&gt;
  set sashelp.shoes;&lt;BR /&gt;
  retain divideby &amp;amp;cntobs;&lt;BR /&gt;
  newnum = sales / divideby;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc print data=new (obs=5);&lt;BR /&gt;
title "Using the Number of Obs ( &amp;amp;cntobs ) from CLASS to divide by in SHOES";&lt;BR /&gt;
var region product sales divideby newnum;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
If you need more help understanding what this program is doing or how to use SAS Macro variables or if this examples does not suit your needs, your best bet for help is to contact SAS Tech Support.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Wed, 31 Oct 2007 18:18:03 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-10-31T18:18:03Z</dc:date>
    <item>
      <title>Creating a macro variable for use in future calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-variable-for-use-in-future-calculation/m-p/5281#M1673</link>
      <description>How can I create a variable (say number of records) from one table to be used in a calculation in another table (without linking the tables).&lt;BR /&gt;
&lt;BR /&gt;
For example, I have a table with 100 records.&lt;BR /&gt;
In another table, I want to divide a number by those X records. In this case, X being 100.&lt;BR /&gt;
Thanks.</description>
      <pubDate>Wed, 31 Oct 2007 17:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-variable-for-use-in-future-calculation/m-p/5281#M1673</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-31T17:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro variable for use in future calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-variable-for-use-in-future-calculation/m-p/5282#M1674</link>
      <description>Your best choice is using SAS Macro variables. This is just one example. There are other ways of creating macro variables.&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select nobs into :cntobs&lt;BR /&gt;
  from dictionary.tables&lt;BR /&gt;
  where libname = "SASHELP" and&lt;BR /&gt;
        memname = "CLASS";&lt;BR /&gt;
quit;&lt;BR /&gt;
     &lt;BR /&gt;
%let cntobs = &amp;amp;cntobs;&lt;BR /&gt;
%put cntobs= &amp;amp;cntobs is the number of obs in SASHELP.CLASS;&lt;BR /&gt;
     &lt;BR /&gt;
data new;&lt;BR /&gt;
  set sashelp.shoes;&lt;BR /&gt;
  retain divideby &amp;amp;cntobs;&lt;BR /&gt;
  newnum = sales / divideby;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc print data=new (obs=5);&lt;BR /&gt;
title "Using the Number of Obs ( &amp;amp;cntobs ) from CLASS to divide by in SHOES";&lt;BR /&gt;
var region product sales divideby newnum;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
If you need more help understanding what this program is doing or how to use SAS Macro variables or if this examples does not suit your needs, your best bet for help is to contact SAS Tech Support.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 31 Oct 2007 18:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-macro-variable-for-use-in-future-calculation/m-p/5282#M1674</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-10-31T18:18:03Z</dc:date>
    </item>
  </channel>
</rss>

