<?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 Cal the obs and Macrotise the value in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Cal-the-obs-and-Macrotise-the-value/m-p/82146#M23637</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i am having a data set data main; input sal; cards; 100 200 run; data mon_sal; input days; cards; 2 3 run; %macro sas_cal; proc sql; select count(*) into :cou from mon_sal; select sal into s1-s&amp;amp;cou from main; quit; data mon_sal; set mon_sal; do i=1 %to &amp;amp;cou; mo_days=days*s&amp;amp;cou; %end; run; %mend; %sa_cal; I am trying to iterate it as the same calulation i want to do for few datasets i want the sal from one dataset and days from another datasets to create new variable how can i macro tise it output of mon_sal; days mo_days 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 200 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 600&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Oct 2012 18:45:34 GMT</pubDate>
    <dc:creator>R_Win</dc:creator>
    <dc:date>2012-10-01T18:45:34Z</dc:date>
    <item>
      <title>Cal the obs and Macrotise the value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cal-the-obs-and-Macrotise-the-value/m-p/82146#M23637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i am having a data set data main; input sal; cards; 100 200 run; data mon_sal; input days; cards; 2 3 run; %macro sas_cal; proc sql; select count(*) into :cou from mon_sal; select sal into s1-s&amp;amp;cou from main; quit; data mon_sal; set mon_sal; do i=1 %to &amp;amp;cou; mo_days=days*s&amp;amp;cou; %end; run; %mend; %sa_cal; I am trying to iterate it as the same calulation i want to do for few datasets i want the sal from one dataset and days from another datasets to create new variable how can i macro tise it output of mon_sal; days mo_days 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 200 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 600&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 18:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cal-the-obs-and-Macrotise-the-value/m-p/82146#M23637</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2012-10-01T18:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Cal the obs and Macrotise the value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cal-the-obs-and-Macrotise-the-value/m-p/82147#M23638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ref this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 18:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cal-the-obs-and-Macrotise-the-value/m-p/82147#M23638</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2012-10-01T18:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Cal the obs and Macrotise the value</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cal-the-obs-and-Macrotise-the-value/m-p/82148#M23639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This does not look like a problem where you would need to get into the complexity of MACRO programming.&amp;nbsp; Normal programming will do just fine.&lt;/P&gt;&lt;P&gt;It will probably work better if your two source datasets had some type of ID variable to identify the rows so that you can match the SAL to the proper DAYS.&amp;nbsp; Perhaps MONTH?&lt;/P&gt;&lt;P&gt;If you are willing to assume that the tables should match row by row then you can use merge without a BY statement or two independent SET statements to read one row from each source table per loop of the data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data main;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input sal;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;200&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data mon_sal;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input days;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data mon_sal;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set main;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set mon_sal;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; mo_days = days*sal;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 19:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cal-the-obs-and-Macrotise-the-value/m-p/82148#M23639</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-10-01T19:09:18Z</dc:date>
    </item>
  </channel>
</rss>

