<?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: using Array/do to assign a letter grade. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537490#M6780</link>
    <description>&lt;P&gt;Thanks for the reply. I am very new to SAS and not sure how to create the arrays or do loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying to find examples of how to write the code and the proper syntax but have been trouble finding one.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Feb 2019 18:38:59 GMT</pubDate>
    <dc:creator>klj81</dc:creator>
    <dc:date>2019-02-21T18:38:59Z</dc:date>
    <item>
      <title>using Array/do to assign a letter grade.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537483#M6777</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;For an assignment, I have a data set that I have to round number grades, and then use array and do statements to assign a letter grade.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data hwweek4;&lt;/P&gt;&lt;P&gt;set sasuser.detail;&lt;/P&gt;&lt;P&gt;Math1=round(Math, 1);&lt;/P&gt;&lt;P&gt;Science1=round(Science, 1);&lt;/P&gt;&lt;P&gt;PE1=round(PE, 1);&lt;/P&gt;&lt;P&gt;Reading1=round (reading, 1);&lt;/P&gt;&lt;P&gt;drop math science pe reading;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now what I need to do with this data set is to create new columns with a grade for each of these subjects using array and do statements.&lt;/P&gt;&lt;P&gt;If grade is above 90 then Grade= A&lt;/P&gt;&lt;P&gt;If grade is 75-79 then Grade is a B&lt;/P&gt;&lt;P&gt;If Grade is 60-74 then Grade is C&lt;/P&gt;&lt;P&gt;Below 60 but not missing is a D&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 18:20:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537483#M6777</guid>
      <dc:creator>klj81</dc:creator>
      <dc:date>2019-02-21T18:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: using Array/do to assign a letter grade.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537485#M6778</link>
      <description>&lt;P&gt;1. Create two arrays for your subjects numerical grade and one for their alphabetical grade&lt;/P&gt;
&lt;P&gt;2. Write a series of IF statements for one variable first&lt;/P&gt;
&lt;P&gt;2. Add a DO loop around it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Change the one variable to be arrayName(i) instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or do this in one line with a format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/258707"&gt;@klj81&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;For an assignment, I have a data set that I have to round number grades, and then use array and do statements to assign a letter grade.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So far I have&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data hwweek4;&lt;/P&gt;
&lt;P&gt;set sasuser.detail;&lt;/P&gt;
&lt;P&gt;Math1=round(Math, 1);&lt;/P&gt;
&lt;P&gt;Science1=round(Science, 1);&lt;/P&gt;
&lt;P&gt;PE1=round(PE, 1);&lt;/P&gt;
&lt;P&gt;Reading1=round (reading, 1);&lt;/P&gt;
&lt;P&gt;drop math science pe reading;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now what I need to do with this data set is to create new columns with a grade for each of these subjects using array and do statements.&lt;/P&gt;
&lt;P&gt;If grade is above 90 then Grade= A&lt;/P&gt;
&lt;P&gt;If grade is 75-79 then Grade is a B&lt;/P&gt;
&lt;P&gt;If Grade is 60-74 then Grade is C&lt;/P&gt;
&lt;P&gt;Below 60 but not missing is a D&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 18:25:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537485#M6778</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-21T18:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: using Array/do to assign a letter grade.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537489#M6779</link>
      <description>&lt;P&gt;I took the example sashelp.class and developed the code as per your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check and update as per your data and test&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
array grades(2)$ heightgrade weightgrade;
array result1(2) height weight;
array result2(2) height2 weight2;
do i = 1 to 2;
if result1(i) ne . then result2(i)=round(result1(i),1);
if result2(i)&amp;gt;90 then grades(i)='A';
else if 75&amp;lt;=result2(i)&amp;lt;=89  then grades(i)='B';
else if 60&amp;lt;=result2(i)&amp;lt;=74 then grades(i)='C';
else if .&amp;lt;result2(i)&amp;lt;60 then grades(i)='D';
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Feb 2019 18:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537489#M6779</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-02-21T18:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: using Array/do to assign a letter grade.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537490#M6780</link>
      <description>&lt;P&gt;Thanks for the reply. I am very new to SAS and not sure how to create the arrays or do loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying to find examples of how to write the code and the proper syntax but have been trouble finding one.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 18:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537490#M6780</guid>
      <dc:creator>klj81</dc:creator>
      <dc:date>2019-02-21T18:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: using Array/do to assign a letter grade.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537491#M6781</link>
      <description>&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/sas-arrays/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/seminars/sas-arrays/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/258707"&gt;@klj81&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the reply. I am very new to SAS and not sure how to create the arrays or do loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been trying to find examples of how to write the code and the proper syntax but have been trouble finding one.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 18:43:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537491#M6781</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-21T18:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: using Array/do to assign a letter grade.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537495#M6782</link>
      <description>&lt;P&gt;This worked perfectly for me..&lt;/P&gt;&lt;P&gt;thank you so much I really appreciate your help!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 18:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Array-do-to-assign-a-letter-grade/m-p/537495#M6782</guid>
      <dc:creator>klj81</dc:creator>
      <dc:date>2019-02-21T18:58:12Z</dc:date>
    </item>
  </channel>
</rss>

