<?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: Constructing Dummy Variable for Prior Event in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Constructing-Dummy-Variable-for-Prior-Event/m-p/487024#M126824</link>
    <description>Thank you so much for your help! I really appreciate it. The code you suggested does exactly what I was trying to do.&lt;BR /&gt;</description>
    <pubDate>Wed, 15 Aug 2018 15:08:22 GMT</pubDate>
    <dc:creator>aimsmith12</dc:creator>
    <dc:date>2018-08-15T15:08:22Z</dc:date>
    <item>
      <title>Constructing Dummy Variable for Prior Event</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Constructing-Dummy-Variable-for-Prior-Event/m-p/486866#M126741</link>
      <description>&lt;P&gt;Good evening,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working with a panel data set consisting of&amp;nbsp;firm-year observations. This data set includes a dummy variable called "acquisition"&amp;nbsp;that equals 1 if the firm made an acquisition during the current year and 0 otherwise. Now, I'd like to construct a new dummy variable that captures prior acquisition experience. More specifically, I'd like for this new variable to equal&amp;nbsp;1 if the acquisition dummy for this firm equals 1 in any prior year and 0 otherwise. Unfortunately, I'm having trouble figuring out the appropriate code.&amp;nbsp;I thought it would be easiest to first create a&amp;nbsp;count variable that&amp;nbsp;reveals the number of prior years with merger activity and then construct a dummy variable equal to 1 any time the count variable carries a non-zero value. However, I can't seem to get the count variable to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any advice?&amp;nbsp; For simplicity, you can just assume that the data set consists of 3 variables: id, year, and acquisition (a dummy variable).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Aimee&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 22:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Constructing-Dummy-Variable-for-Prior-Event/m-p/486866#M126741</guid>
      <dc:creator>aimsmith12</dc:creator>
      <dc:date>2018-08-14T22:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Constructing Dummy Variable for Prior Event</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Constructing-Dummy-Variable-for-Prior-Event/m-p/486871#M126745</link>
      <description>&lt;P&gt;One way (assuming your data set is sorted by FIRM YEAR):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by firm;&lt;/P&gt;
&lt;P&gt;retain prior_acquisition;&lt;/P&gt;
&lt;P&gt;if first.firm then prior_acquisition = 0;&lt;/P&gt;
&lt;P&gt;output;&lt;/P&gt;
&lt;P&gt;prior_acquisition = max(prior_acquisition, acquisition);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 23:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Constructing-Dummy-Variable-for-Prior-Event/m-p/486871#M126745</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-08-14T23:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Constructing Dummy Variable for Prior Event</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Constructing-Dummy-Variable-for-Prior-Event/m-p/487024#M126824</link>
      <description>Thank you so much for your help! I really appreciate it. The code you suggested does exactly what I was trying to do.&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Aug 2018 15:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Constructing-Dummy-Variable-for-Prior-Event/m-p/487024#M126824</guid>
      <dc:creator>aimsmith12</dc:creator>
      <dc:date>2018-08-15T15:08:22Z</dc:date>
    </item>
  </channel>
</rss>

