<?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 How to code rating changes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-rating-changes/m-p/87776#M18755</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Below is a small sample of a large data set. I would like to create a dummy variable that is based on changes in Rating – &lt;/P&gt;&lt;P&gt;Dto-plus (t-1)=1 ,&amp;nbsp; if a firm’s Rating changes from a middle notch in year t-1 to a plus notch in year t and maintains a plus notch (not necessarily the same rating as in year t) in year t+1 to t+2, and set to zero otherwise. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How should I program this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;p.s. rating notch was not a variable in the raw data, I put it there to make it easier for you to read, If I create this variable, is it better to use proc format with a numeric value?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firmid year rating rating notch&lt;/P&gt;&lt;P&gt;1001 1990 AAA middle&lt;/P&gt;&lt;P&gt;1001 1991 AA+ plus&lt;/P&gt;&lt;P&gt;1001 1992 AA+ plus&lt;/P&gt;&lt;P&gt;1001 1993 AA middle&lt;/P&gt;&lt;P&gt;1001 1994 AA+ plus&lt;/P&gt;&lt;P&gt;1002 1990 BBB+ plus&lt;/P&gt;&lt;P&gt;1002 1991 BBB+ plus&lt;/P&gt;&lt;P&gt;1002 1992 A- minus&lt;/P&gt;&lt;P&gt;1002 1993 A+ plus&lt;/P&gt;&lt;P&gt;1002 1994 A middle&lt;/P&gt;&lt;P&gt;1002 1995 A- minus&lt;/P&gt;&lt;P&gt;1003 1990 BBB middle&lt;/P&gt;&lt;P&gt;1003 1991 BBB- minus&lt;/P&gt;&lt;P&gt;1003 1992 BB+ plus&lt;/P&gt;&lt;P&gt;1003 1993 BB+ plus&lt;/P&gt;&lt;P&gt;1003 1994 BB- minus&lt;/P&gt;&lt;P&gt;1003 1995 BB- minus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Mar 2013 17:15:07 GMT</pubDate>
    <dc:creator>LanMin</dc:creator>
    <dc:date>2013-03-25T17:15:07Z</dc:date>
    <item>
      <title>How to code rating changes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-rating-changes/m-p/87776#M18755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Below is a small sample of a large data set. I would like to create a dummy variable that is based on changes in Rating – &lt;/P&gt;&lt;P&gt;Dto-plus (t-1)=1 ,&amp;nbsp; if a firm’s Rating changes from a middle notch in year t-1 to a plus notch in year t and maintains a plus notch (not necessarily the same rating as in year t) in year t+1 to t+2, and set to zero otherwise. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How should I program this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;p.s. rating notch was not a variable in the raw data, I put it there to make it easier for you to read, If I create this variable, is it better to use proc format with a numeric value?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firmid year rating rating notch&lt;/P&gt;&lt;P&gt;1001 1990 AAA middle&lt;/P&gt;&lt;P&gt;1001 1991 AA+ plus&lt;/P&gt;&lt;P&gt;1001 1992 AA+ plus&lt;/P&gt;&lt;P&gt;1001 1993 AA middle&lt;/P&gt;&lt;P&gt;1001 1994 AA+ plus&lt;/P&gt;&lt;P&gt;1002 1990 BBB+ plus&lt;/P&gt;&lt;P&gt;1002 1991 BBB+ plus&lt;/P&gt;&lt;P&gt;1002 1992 A- minus&lt;/P&gt;&lt;P&gt;1002 1993 A+ plus&lt;/P&gt;&lt;P&gt;1002 1994 A middle&lt;/P&gt;&lt;P&gt;1002 1995 A- minus&lt;/P&gt;&lt;P&gt;1003 1990 BBB middle&lt;/P&gt;&lt;P&gt;1003 1991 BBB- minus&lt;/P&gt;&lt;P&gt;1003 1992 BB+ plus&lt;/P&gt;&lt;P&gt;1003 1993 BB+ plus&lt;/P&gt;&lt;P&gt;1003 1994 BB- minus&lt;/P&gt;&lt;P&gt;1003 1995 BB- minus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 17:15:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-rating-changes/m-p/87776#M18755</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-03-25T17:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to code rating changes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-rating-changes/m-p/87777#M18756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about this..although I didn't see any case where the indicator variable was anything other than 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA HAVE;&lt;/P&gt;&lt;P&gt;INPUT firmid year rating $ notch $;&lt;/P&gt;&lt;P&gt;CARDS;&lt;/P&gt;&lt;P&gt;1001 1990 AAA middle&lt;/P&gt;&lt;P&gt;1001 1991 AA+ plus&lt;/P&gt;&lt;P&gt;1001 1992 AA+ plus&lt;/P&gt;&lt;P&gt;1001 1993 AA middle&lt;/P&gt;&lt;P&gt;1001 1994 AA+ plus&lt;/P&gt;&lt;P&gt;1002 1990 BBB+ plus&lt;/P&gt;&lt;P&gt;1002 1991 BBB+ plus&lt;/P&gt;&lt;P&gt;1002 1992 A- minus&lt;/P&gt;&lt;P&gt;1002 1993 A+ plus&lt;/P&gt;&lt;P&gt;1002 1994 A middle&lt;/P&gt;&lt;P&gt;1002 1995 A- minus&lt;/P&gt;&lt;P&gt;1003 1990 BBB middle&lt;/P&gt;&lt;P&gt;1003 1991 BBB- minus&lt;/P&gt;&lt;P&gt;1003 1992 BB+ plus&lt;/P&gt;&lt;P&gt;1003 1993 BB+ plus&lt;/P&gt;&lt;P&gt;1003 1994 BB- minus&lt;/P&gt;&lt;P&gt;1003 1995 BB- minus&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;RUN;&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;SELECT &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Curr.*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,case when lastyear.notch='middle' and curr.notch='plus' and year1.notch='plus' and year2.notch='plus' then 1 else 0 end as Indicator_Var&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HAVE as curr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; left join have as LastYear&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on curr.firmid=lastyear.firmid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and curr.year-1=lastyear.year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; left join have as year1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on curr.firmid=year1.firmid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and curr.year+1=year1.year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; left join have as year2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on curr.firmid=year2.firmid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and curr.year+2=year2.year;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 17:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-rating-changes/m-p/87777#M18756</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-03-25T17:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to code rating changes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-rating-changes/m-p/87778#M18757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your way is so efficient. I thought I have to create lags. are there some books for advanced sas programming you would recommend?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Lan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2013 20:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-rating-changes/m-p/87778#M18757</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-03-26T20:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to code rating changes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-rating-changes/m-p/87779#M18758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry...my background is SQL, not SAS.&amp;nbsp; Even after using SAS for 10 years, I still find new SAS ways of doing things that are a surprise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 12:52:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-rating-changes/m-p/87779#M18758</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-03-27T12:52:57Z</dc:date>
    </item>
  </channel>
</rss>

