<?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: industry-specialist auditor dummy in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/industry-specialist-auditor-dummy/m-p/116407#M32115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have not run through all of your obs, so I don't how long it would take to run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname test 'h:\temp\';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct b.*, case when a.fyear=b.fyear and&lt;/P&gt;&lt;P&gt;&amp;nbsp; a.sic2=b.sic2 and&lt;/P&gt;&lt;P&gt;a.auditor_fkey=b.auditor_fkey and&lt;/P&gt;&lt;P&gt;not missing(b.auditor_fkey)&lt;/P&gt;&lt;P&gt;then 1&lt;/P&gt;&lt;P&gt;else 0&lt;/P&gt;&lt;P&gt;end as dummy&lt;/P&gt;&lt;P&gt;from test.test b&lt;/P&gt;&lt;P&gt;left join &lt;/P&gt;&lt;P&gt;(select fyear, sic2, auditor_fkey from&lt;/P&gt;&lt;P&gt;(select fyear, sic2, auditor_fkey, sum(at) as atsum from test.test&amp;nbsp; &lt;/P&gt;&lt;P&gt;group by fyear, sic2, auditor_fkey)&lt;/P&gt;&lt;P&gt;group by fyear, sic2&lt;/P&gt;&lt;P&gt;having atsum=max(atsum)) a&lt;/P&gt;&lt;P&gt;on a.fyear=b.fyear and&lt;/P&gt;&lt;P&gt;&amp;nbsp; a.sic2=b.sic2 and&lt;/P&gt;&lt;P&gt;a.auditor_fkey=b.auditor_fkey ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 May 2012 12:36:52 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2012-05-16T12:36:52Z</dc:date>
    <item>
      <title>industry-specialist auditor dummy</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/industry-specialist-auditor-dummy/m-p/116405#M32113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to identify for each company code (cik number) whether its auditor is a industry-specialist auditor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An industry-specialist auditor is firstly required to be identified for&amp;nbsp; each sic2 code (representing industry) for every financial year (fyear) by finding who is the auditor (represented by auditor_fkey) that possesses the highest value of&amp;nbsp; client's (cik number)'s total assets (at).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once an industry-specialist auditor is chosen for each industry for each financial year, then an industry-specialist auditor dummy need to be created. If the auditor of the company=industry-specialist auditor, dummy=1, otherwise =0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example: go to row 7683 to 7773 for sic 80 for financial year 2001, all the total assets value for auditor 1 (PWC) 2, 3 , 4 , 5 need to be summed up for the same sic code. Then we compare which auditor owns the highest value of total asset value of its client. Then that is the industry-specialist auditor for sic code 80. Then we go to each firm from 7683 till 7773 and create a dummy if the auditor=industry-specialist auditor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This then apply to each sic code for each financial year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you help me on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data is attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 09:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/industry-specialist-auditor-dummy/m-p/116405#M32113</guid>
      <dc:creator>mei</dc:creator>
      <dc:date>2012-05-16T09:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: industry-specialist auditor dummy</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/industry-specialist-auditor-dummy/m-p/116406#M32114</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 summary data=test nway;&lt;BR /&gt;class fyear sic2 auditor_fkey;&lt;BR /&gt;var at;&lt;BR /&gt;output out=test_sum (drop=_:) sum=;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=test_sum;&lt;BR /&gt;by fyear sic2 descending at;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ind_spec;&lt;BR /&gt;set test_sum;&lt;BR /&gt;by fyear sic2;&lt;BR /&gt;if first.sic2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table dummy as&lt;BR /&gt;select&lt;BR /&gt;&amp;nbsp;&amp;nbsp; a.*,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; case&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when b.auditor_fkey is not null then 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp; end as dummy&lt;BR /&gt;from&lt;BR /&gt;&amp;nbsp;&amp;nbsp; test&amp;nbsp;&amp;nbsp;&amp;nbsp; a&lt;BR /&gt;&amp;nbsp;&amp;nbsp; left join&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ind_spec&amp;nbsp;&amp;nbsp; b&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.fyear = b.fyear and&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.sic2 = b.sic2 and&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.auditor_fkey = b.auditor_fkey&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 12:35:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/industry-specialist-auditor-dummy/m-p/116406#M32114</guid>
      <dc:creator>FloydNevseta</dc:creator>
      <dc:date>2012-05-16T12:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: industry-specialist auditor dummy</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/industry-specialist-auditor-dummy/m-p/116407#M32115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have not run through all of your obs, so I don't how long it would take to run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname test 'h:\temp\';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct b.*, case when a.fyear=b.fyear and&lt;/P&gt;&lt;P&gt;&amp;nbsp; a.sic2=b.sic2 and&lt;/P&gt;&lt;P&gt;a.auditor_fkey=b.auditor_fkey and&lt;/P&gt;&lt;P&gt;not missing(b.auditor_fkey)&lt;/P&gt;&lt;P&gt;then 1&lt;/P&gt;&lt;P&gt;else 0&lt;/P&gt;&lt;P&gt;end as dummy&lt;/P&gt;&lt;P&gt;from test.test b&lt;/P&gt;&lt;P&gt;left join &lt;/P&gt;&lt;P&gt;(select fyear, sic2, auditor_fkey from&lt;/P&gt;&lt;P&gt;(select fyear, sic2, auditor_fkey, sum(at) as atsum from test.test&amp;nbsp; &lt;/P&gt;&lt;P&gt;group by fyear, sic2, auditor_fkey)&lt;/P&gt;&lt;P&gt;group by fyear, sic2&lt;/P&gt;&lt;P&gt;having atsum=max(atsum)) a&lt;/P&gt;&lt;P&gt;on a.fyear=b.fyear and&lt;/P&gt;&lt;P&gt;&amp;nbsp; a.sic2=b.sic2 and&lt;/P&gt;&lt;P&gt;a.auditor_fkey=b.auditor_fkey ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 12:36:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/industry-specialist-auditor-dummy/m-p/116407#M32115</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-05-16T12:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: industry-specialist auditor dummy</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/industry-specialist-auditor-dummy/m-p/116408#M32116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hai Kuo:&lt;/P&gt;&lt;P&gt;From the log:&lt;/P&gt;&lt;P&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess this does not matter right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The results from the above 2 programs are similar, thanks a lot!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2012 06:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/industry-specialist-auditor-dummy/m-p/116408#M32116</guid>
      <dc:creator>mei</dc:creator>
      <dc:date>2012-05-18T06:01:36Z</dc:date>
    </item>
  </channel>
</rss>

