<?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 Control firm pick in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Control-firm-pick/m-p/875512#M345929</link>
    <description>&lt;P&gt;Dear Madam/Sir,&lt;/P&gt;&lt;P&gt;I would like to pick control firms (gvkey2 in dataset2 with respect to gvkey1 and year) using treatment firms (gvkey and merge_year in the same industry_code in dataset 1).&lt;/P&gt;&lt;P&gt;Have&lt;/P&gt;&lt;P&gt;dataset 1&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataset 2&lt;/P&gt;&lt;P&gt;gvkey&amp;nbsp; merge_year industry_code&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;gvkey1 year gvkey2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want&lt;/P&gt;&lt;P&gt;new dataset (matching identifier: gvkey(dataset1)=gvkey1(dataset2), merge_year(dataset2)=year(dataset2))&lt;/P&gt;&lt;P&gt;gvkey&amp;nbsp; merge_year industry_code &lt;STRONG&gt;&lt;U&gt;gvkey2&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any programming idea will be highly appreciated. Two datasets are attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Joon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 May 2023 19:30:18 GMT</pubDate>
    <dc:creator>joon1</dc:creator>
    <dc:date>2023-05-12T19:30:18Z</dc:date>
    <item>
      <title>Control firm pick</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Control-firm-pick/m-p/875512#M345929</link>
      <description>&lt;P&gt;Dear Madam/Sir,&lt;/P&gt;&lt;P&gt;I would like to pick control firms (gvkey2 in dataset2 with respect to gvkey1 and year) using treatment firms (gvkey and merge_year in the same industry_code in dataset 1).&lt;/P&gt;&lt;P&gt;Have&lt;/P&gt;&lt;P&gt;dataset 1&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataset 2&lt;/P&gt;&lt;P&gt;gvkey&amp;nbsp; merge_year industry_code&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;gvkey1 year gvkey2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want&lt;/P&gt;&lt;P&gt;new dataset (matching identifier: gvkey(dataset1)=gvkey1(dataset2), merge_year(dataset2)=year(dataset2))&lt;/P&gt;&lt;P&gt;gvkey&amp;nbsp; merge_year industry_code &lt;STRONG&gt;&lt;U&gt;gvkey2&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any programming idea will be highly appreciated. Two datasets are attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Joon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 19:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Control-firm-pick/m-p/875512#M345929</guid>
      <dc:creator>joon1</dc:creator>
      <dc:date>2023-05-12T19:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Control firm pick</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Control-firm-pick/m-p/875554#M345944</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107110"&gt;@joon1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to pick control firms (gvkey2 in dataset2 with respect to gvkey1 and year) using treatment firms (gvkey and merge_year in the same industry_code in dataset 1).&lt;/P&gt;
&lt;P&gt;Have&lt;/P&gt;
&lt;P&gt;dataset 1&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataset 2&lt;/P&gt;
&lt;P&gt;gvkey&amp;nbsp; merge_year industry_code&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;gvkey1 year gvkey2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Want&lt;/P&gt;
&lt;P&gt;new dataset (matching identifier: gvkey(dataset1)=gvkey1(dataset2), merge_year(dataset2)=year(dataset2))&lt;/P&gt;
&lt;P&gt;gvkey&amp;nbsp; merge_year industry_code &lt;STRONG&gt;&lt;U&gt;gvkey2&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any programming idea will be highly appreciated. Two datasets are attached.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand your task well enough to consider this a program question yet.&amp;nbsp; My questions are:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Your dataset2 apparently does not have an industry code variable, a variable that you want for matching.&amp;nbsp; Does that mean all pairs of gvkey1/gvkey2 in dataset2 represent companies already known to have the same industry code for the designated year?&amp;nbsp; Or do you need to search dataset1 to confirm whether two distinct GVKEY's have the same industry code in the same year?&lt;/LI&gt;
&lt;LI&gt;Assuming the industry code match mystery is resolved.
&lt;OL&gt;
&lt;LI&gt;What if, for a given gvkey1 in dataset1, there are no records in dataset2 with year=merge_year from dataset1?&lt;/LI&gt;
&lt;LI&gt;More generally what if there are N gvkey's in dataset1 all sharing the same merge_year and industry code but there are fewer than N matches available in dataset2?&lt;/LI&gt;
&lt;LI&gt;On the other hand, what if there are more than N dataset2 records that can match a set of N records in dataset1 with a given merge_year?&amp;nbsp; (this answer is probably self-evident, but please humor me).&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Sat, 13 May 2023 01:24:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Control-firm-pick/m-p/875554#M345944</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-05-13T01:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Control firm pick</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Control-firm-pick/m-p/875605#M345975</link>
      <description>&lt;P&gt;Thank you for insightful comments, mkeintz.&lt;/P&gt;&lt;P&gt;You are correct. To simplify programming, I have dropped observations that have different industry (SIC code) between gvkey1 and gvkey 2 in dataset 2 to have only observations with the same industry between gvkey1 and gvkey2. The industry issue is resolved. I attach a part of revised dataset2 (it is over 8 million observations). For your a second serious questions, my goal is to have unique control firms (gvkey2) in a particular year that match between gvkey/merge_year in dataset1 and gvkey1/year in dataset 2. It could be multiple control firms (gvkey2) matched with gvkey in dataset 1 in a particular year.&lt;/P&gt;&lt;P&gt;Any programming advice will be highly appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Joon1&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 18:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Control-firm-pick/m-p/875605#M345975</guid>
      <dc:creator>joon1</dc:creator>
      <dc:date>2023-05-13T18:00:29Z</dc:date>
    </item>
  </channel>
</rss>

