<?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: multiply two tables together in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/multiply-two-tables-together/m-p/69412#M7980</link>
    <description>[pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data one;&lt;BR /&gt;
 count+1;&lt;BR /&gt;
 set sashelp.class(keep=height);&lt;BR /&gt;
run;&lt;BR /&gt;
data two;&lt;BR /&gt;
 count+1;&lt;BR /&gt;
 set sashelp.class(keep=weight);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
 merge one two;&lt;BR /&gt;
 by count;&lt;BR /&gt;
 want=height*weight;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
But you need to rename variables firstly if these two tables have the same variable name.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
    <pubDate>Thu, 02 Jun 2011 07:00:11 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-06-02T07:00:11Z</dc:date>
    <item>
      <title>multiply two tables together</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/multiply-two-tables-together/m-p/69409#M7977</link>
      <description>I've got 2 tables that I want multiplied together:&lt;BR /&gt;
&lt;BR /&gt;
Table1                  Table 2&lt;BR /&gt;
r1c1 r1c2 r1c3       r1c1 r1c2 r1c3&lt;BR /&gt;
r2c1 r2c2 r2c3       r2c1 r2c2 r2c3&lt;BR /&gt;
&lt;BR /&gt;
result should be:&lt;BR /&gt;
r1c1*r1c1  r1c2*r2c2 ....&lt;BR /&gt;
r2c1*r2c1   .....&lt;BR /&gt;
&lt;BR /&gt;
can someone help?  Thanks</description>
      <pubDate>Wed, 25 May 2011 17:18:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/multiply-two-tables-together/m-p/69409#M7977</guid>
      <dc:creator>pcbc</dc:creator>
      <dc:date>2011-05-25T17:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: multiply two tables together</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/multiply-two-tables-together/m-p/69410#M7978</link>
      <description>Look at using an ARRAY within a DATA step to reference your SAS variables more conveniently than each individual one.  Then you can use a DO / END  paragraph along with the ARRAY and appropriate/desired subscript to compute some new / existing (?) SAS variable, as needed.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
using arrays data step site:sas.com</description>
      <pubDate>Wed, 25 May 2011 19:55:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/multiply-two-tables-together/m-p/69410#M7978</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-05-25T19:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: multiply two tables together</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/multiply-two-tables-together/m-p/69411#M7979</link>
      <description>Hi: &lt;BR /&gt;
  Are your variables actually named r1c1, r1c2, r1c3, etc???? Or, are they more meaningful names like NAME, AGE1, HT1, WT1 in Table1 and perhaps NAME, AGE2, HT2 and WT2 in Table2??? Is there any identifier on the rows/observations, such as NAME?? Does each dataset have EXACTLY the same number of observations?? Do you want ROW1 in the first table matched to ROW1 in the second table -- ALWAYS?? &lt;BR /&gt;
&lt;BR /&gt;
Generally speaking, the "row" number or observation number is not fixed or saved in a SAS dataset and can be impacted by sort order. So for example, SASHELP.CLASS has 19 rows/observations. If I sort the file by ascending name, then Alfred's observation will become Row 1 in the file. But if I sort by SEX and then NAME, then Alice's observation will become Row 1 in the file. So if you run this code, you will see that observation #1 will change depending on the sort order used for the file:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sort data=sashelp.class out=class;&lt;BR /&gt;
  by name;&lt;BR /&gt;
run;&lt;BR /&gt;
          &lt;BR /&gt;
proc print data=class;&lt;BR /&gt;
  title 'Sort Order by Name';&lt;BR /&gt;
run;&lt;BR /&gt;
       &lt;BR /&gt;
proc sort data=sashelp.class out=class;&lt;BR /&gt;
  by sex name;&lt;BR /&gt;
run;&lt;BR /&gt;
      &lt;BR /&gt;
proc print data=class;&lt;BR /&gt;
  title 'Sort Order by Name within Sex';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
  It seems to me that there is some important information missing in your description of the problem. While Scott's suggestion might be the way to go, depending on whether you have identifiers in each table that you have to match or whether each table has exactly the same number of rows, you might choose a different approach.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 25 May 2011 20:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/multiply-two-tables-together/m-p/69411#M7979</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-05-25T20:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: multiply two tables together</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/multiply-two-tables-together/m-p/69412#M7980</link>
      <description>[pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data one;&lt;BR /&gt;
 count+1;&lt;BR /&gt;
 set sashelp.class(keep=height);&lt;BR /&gt;
run;&lt;BR /&gt;
data two;&lt;BR /&gt;
 count+1;&lt;BR /&gt;
 set sashelp.class(keep=weight);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
 merge one two;&lt;BR /&gt;
 by count;&lt;BR /&gt;
 want=height*weight;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
But you need to rename variables firstly if these two tables have the same variable name.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 02 Jun 2011 07:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/multiply-two-tables-together/m-p/69412#M7980</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-06-02T07:00:11Z</dc:date>
    </item>
  </channel>
</rss>

