<?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: Matching and then Calculating Average in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Matching-and-then-Calculating-Average/m-p/238728#M43870</link>
    <description>&lt;P&gt;It isn't clear from your question whether you have combined the data with your cuspid. If not it appears the only thing you have to match on is the name in the UW_RANK under manager_lead_name and the values there do not match how they appear in your lpo data set.&lt;/P&gt;
&lt;P&gt;If you went to extra work to create the manager_lead_name with multiple companys in the lpo set I would suggest going back so that you have each company separately:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;issue_date&amp;nbsp; cuspid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; manager_lead_name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; issue_year&lt;/P&gt;
&lt;P&gt;09/11/2006 00083310&amp;nbsp; Credit Suisse&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2006&lt;/P&gt;
&lt;P&gt;09/11/2006 00083310&amp;nbsp; JP Morgan &amp;amp; Co Inc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2006&lt;/P&gt;
&lt;P&gt;09/11/2006 00083310&amp;nbsp; Bear Stearns and Co inc 2006&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example. That will be much easier to merge the rank data on (lpo refers to a set modified as above):&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; create table merged as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; select lpo.issue_date, lpo.cuspid, lpo.manager_lead_name, lpo.issue_year, uw_rank.rank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; from lpo join uw_rank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on lpo.manager_lead_name=uw_rank.manager_lead_name and lpo.issue_year = uw_rank.year&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;Then any of proc summary, means, report or tabulate can create the summaries.&lt;/P&gt;
&lt;P&gt;proc means data=merged mean;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class manager_lead_name issue_year;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var rank;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2015 16:47:12 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-12-10T16:47:12Z</dc:date>
    <item>
      <title>Matching and then Calculating Average</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-and-then-Calculating-Average/m-p/238672#M43846</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My "Ipo" dataset looks the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1122i112B502A7B938C93/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Ipo.PNG" title="Ipo.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I attach another&amp;nbsp;file "uw_rank". This file has the ranks of different manager in different years. I need to create a variable which will show the average rank of the managers in the "Ipo" dataset. For example, the first observation in the "Ipo" dataset (cusip: 00083310 and issue_year: 2006) has 3 managers: Credit Suisse, JP Morgan &amp;amp; Co Inc, and Bear Stearns &amp;amp; Co. Ranks of these 3 managers can be found in the "uw_rank" dataset. From this dataset, it can be seen that Credit Suisse does not have any rank (i.e. rank is blank), JP Morgan &amp;amp; Co cannot be found and Bear Stearns &amp;amp; Co has rank of 8.001 in 2006. So the average rank of this observation will be 8.001/1 = 8.001 (since only one manager has rank in this year 2006).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Abu&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 12:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-and-then-Calculating-Average/m-p/238672#M43846</guid>
      <dc:creator>AbuChowdhury</dc:creator>
      <dc:date>2015-12-10T12:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Matching and then Calculating Average</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Matching-and-then-Calculating-Average/m-p/238728#M43870</link>
      <description>&lt;P&gt;It isn't clear from your question whether you have combined the data with your cuspid. If not it appears the only thing you have to match on is the name in the UW_RANK under manager_lead_name and the values there do not match how they appear in your lpo data set.&lt;/P&gt;
&lt;P&gt;If you went to extra work to create the manager_lead_name with multiple companys in the lpo set I would suggest going back so that you have each company separately:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;issue_date&amp;nbsp; cuspid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; manager_lead_name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; issue_year&lt;/P&gt;
&lt;P&gt;09/11/2006 00083310&amp;nbsp; Credit Suisse&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2006&lt;/P&gt;
&lt;P&gt;09/11/2006 00083310&amp;nbsp; JP Morgan &amp;amp; Co Inc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2006&lt;/P&gt;
&lt;P&gt;09/11/2006 00083310&amp;nbsp; Bear Stearns and Co inc 2006&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example. That will be much easier to merge the rank data on (lpo refers to a set modified as above):&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; create table merged as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; select lpo.issue_date, lpo.cuspid, lpo.manager_lead_name, lpo.issue_year, uw_rank.rank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; from lpo join uw_rank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on lpo.manager_lead_name=uw_rank.manager_lead_name and lpo.issue_year = uw_rank.year&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;Then any of proc summary, means, report or tabulate can create the summaries.&lt;/P&gt;
&lt;P&gt;proc means data=merged mean;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class manager_lead_name issue_year;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var rank;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Matching-and-then-Calculating-Average/m-p/238728#M43870</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-12-10T16:47:12Z</dc:date>
    </item>
  </channel>
</rss>

