<?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: How to fix the rating? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845090#M36779</link>
    <description>&lt;P&gt;Please show us a portion of this data set, as working SAS data step code, which you can type in yourself, or follow &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;. Do not provide the data as an Excel file. Do not provide the data as a screen capture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, you should probably be showing us a portion of the data (following the above guidelines) every single time you present a problem here in the SAS communities.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Nov 2022 11:57:08 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-11-18T11:57:08Z</dc:date>
    <item>
      <title>How to fix the rating?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845077#M36776</link>
      <description>&lt;P&gt;Hi, i'm trying to convert the rating to numbers but then when I plot the freq I see that all the ratin are 10. How to fix this?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc import 
datafile = "C:\Users\amarroccel001\Desktop\DB\20221013_DB_.xlsx"
dbms=xlsx 
out=pd_finali;
sheet="sheet1";
run;
%let rating_unrated = 10;

data pd_finali_rating;
set pd_finali;
if RATING in ("ND", "NULL", "", "Unrated") then Rating_num=&amp;amp;rating_unrated.;
    else if RATING in ("AAA" "Aaa") then Rating_num=1;
    else if RATING in ("AA+" "Aa1") then Rating_num=2;
    else if RATING in ("AA" "Aa2") then Rating_num=3;
    else if RATING in ("AA-" "Aa3") then Rating_num=4;
    else if RATING in ("A+" "A1") then Rating_num=5;
    else if RATING in ("A" "A2") then Rating_num=6;
    else if RATING in ("A-" "A3") then Rating_num=7;
    else if RATING in ("BBB+" "Baa1") then Rating_num=8;
    else if RATING in ("BBB" "Baa2") then Rating_num=9;
    else if RATING in ("BBB-" "Baa3") then Rating_num=10;
    else if RATING in ("BB+" "Ba1") then Rating_num=11;
    else if RATING in ("BB" "Ba2") then Rating_num=12;
    else if RATING in ("BB-" "Ba3") then Rating_num=13;
    else if RATING in ("B+" "B1") then Rating_num=14;
    else if RATING in ("B" "B2") then Rating_num=15;
    else if RATING in ("B-" "B3") then Rating_num=16;
    else if RATING in ("CCC+" "Caa1") then Rating_num=17;
    else if RATING in ("CCC" "Caa2") then Rating_num=18;
    else if RATING in ("CCC-" "Caa3") then Rating_num=19;
    else if RATING in ("CC" "Ca") then Rating_num=20;
    else if RATING in ("C") then Rating_num=21;
    else if RATING in ("SD" "C" "DDD") then Rating_num=22;
    else if RATING in ("D" "DD") then Rating_num=23;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Nov 2022 11:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845077#M36776</guid>
      <dc:creator>ari2495</dc:creator>
      <dc:date>2022-11-18T11:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix the rating?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845078#M36777</link>
      <description>Hello, &lt;BR /&gt;does RATING contain the expected rating string? I.e. Have you output it via put or the like?&lt;BR /&gt;--fja</description>
      <pubDate>Fri, 18 Nov 2022 11:18:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845078#M36777</guid>
      <dc:creator>fja</dc:creator>
      <dc:date>2022-11-18T11:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix the rating?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845079#M36778</link>
      <description>hi I checked and there are many classes in the original dataset</description>
      <pubDate>Fri, 18 Nov 2022 11:20:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845079#M36778</guid>
      <dc:creator>ari2495</dc:creator>
      <dc:date>2022-11-18T11:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix the rating?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845090#M36779</link>
      <description>&lt;P&gt;Please show us a portion of this data set, as working SAS data step code, which you can type in yourself, or follow &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;. Do not provide the data as an Excel file. Do not provide the data as a screen capture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, you should probably be showing us a portion of the data (following the above guidelines) every single time you present a problem here in the SAS communities.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 11:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845090#M36779</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-18T11:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix the rating?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845093#M36780</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/436841"&gt;@ari2495&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;hi I checked and there are many classes in the original dataset&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then none of those are caught by your code. This example code demonstrates that your data step works, given expected data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pd_finali;
infile datalines truncover;
input rating $;
datalines;
ND
NULL

Unrated
AAA
BBB-
CCC+
;

%let rating_unrated = 10;

data pd_finali_rating;
set pd_finali;
if RATING in ("ND", "NULL", "", "Unrated") then Rating_num=&amp;amp;rating_unrated.;
    else if RATING in ("AAA" "Aaa") then Rating_num=1;
    else if RATING in ("AA+" "Aa1") then Rating_num=2;
    else if RATING in ("AA" "Aa2") then Rating_num=3;
    else if RATING in ("AA-" "Aa3") then Rating_num=4;
    else if RATING in ("A+" "A1") then Rating_num=5;
    else if RATING in ("A" "A2") then Rating_num=6;
    else if RATING in ("A-" "A3") then Rating_num=7;
    else if RATING in ("BBB+" "Baa1") then Rating_num=8;
    else if RATING in ("BBB" "Baa2") then Rating_num=9;
    else if RATING in ("BBB-" "Baa3") then Rating_num=10;
    else if RATING in ("BB+" "Ba1") then Rating_num=11;
    else if RATING in ("BB" "Ba2") then Rating_num=12;
    else if RATING in ("BB-" "Ba3") then Rating_num=13;
    else if RATING in ("B+" "B1") then Rating_num=14;
    else if RATING in ("B" "B2") then Rating_num=15;
    else if RATING in ("B-" "B3") then Rating_num=16;
    else if RATING in ("CCC+" "Caa1") then Rating_num=17;
    else if RATING in ("CCC" "Caa2") then Rating_num=18;
    else if RATING in ("CCC-" "Caa3") then Rating_num=19;
    else if RATING in ("CC" "Ca") then Rating_num=20;
    else if RATING in ("C") then Rating_num=21;
    else if RATING in ("SD" "C" "DDD") then Rating_num=22;
    else if RATING in ("D" "DD") then Rating_num=23;
run;

proc print data=pd_finali_rating noobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;rating	Rating_num
ND	10
NULL	10
 	10
Unrated	10
AAA	1
BBB-	10
CCC+	17
&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Nov 2022 12:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-fix-the-rating/m-p/845093#M36780</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-18T12:02:39Z</dc:date>
    </item>
  </channel>
</rss>

