<?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 use arrays in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-arrays/m-p/48266#M13040</link>
    <description>Hi:&lt;BR /&gt;
  Where do you envision using an ARRAY??? Are you thiinking of using an array construct for the lookup of the letter grade to the GPA??? In your case, I'd use a format for doing the lookup.&lt;BR /&gt;
 &lt;BR /&gt;
  The format technique is shown on page 6 of this paper:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2008/095-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/095-2008.pdf&lt;/A&gt; (and there are comparisons of other techniques as well)&lt;BR /&gt;
&lt;BR /&gt;
  This previous forum posting showed the use of a format to create a new variable:&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=17511䑧" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=17511䑧&lt;/A&gt; (at the bottom of the post)&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Tue, 12 Apr 2011 14:07:20 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2011-04-12T14:07:20Z</dc:date>
    <item>
      <title>how to use arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-arrays/m-p/48265#M13039</link>
      <description>I have data concerning semester grades and GPAs. one variable is credits (contains the number of credits a class is worth) and another variable grade (contains the letter grade that was received in the class). I want to create a new variable using arrays that would be GPA (number of credits for a specific class*grade received in that class(i.e. 4.0 for an A, 3.7 for an A-, 3.4 for a B+, etc...). Does that make sense? Here is some sample data:&lt;BR /&gt;
&lt;BR /&gt;
Class             Credits  LetterGrade&lt;BR /&gt;
&lt;BR /&gt;
STAT  361       3.0       C&lt;BR /&gt;
STAT  536       3.0       B+&lt;BR /&gt;
ENGL  251      3.0       B&lt;BR /&gt;
HLTH  129       1.0       D+&lt;BR /&gt;
PE D  190       0.5       B+&lt;BR /&gt;
PE D  270       1.0       B&lt;BR /&gt;
PE D  478R     1.0       A-&lt;BR /&gt;
PE S  129       0.5       A</description>
      <pubDate>Tue, 12 Apr 2011 05:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-arrays/m-p/48265#M13039</guid>
      <dc:creator>PCrider</dc:creator>
      <dc:date>2011-04-12T05:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to use arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-arrays/m-p/48266#M13040</link>
      <description>Hi:&lt;BR /&gt;
  Where do you envision using an ARRAY??? Are you thiinking of using an array construct for the lookup of the letter grade to the GPA??? In your case, I'd use a format for doing the lookup.&lt;BR /&gt;
 &lt;BR /&gt;
  The format technique is shown on page 6 of this paper:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2008/095-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/095-2008.pdf&lt;/A&gt; (and there are comparisons of other techniques as well)&lt;BR /&gt;
&lt;BR /&gt;
  This previous forum posting showed the use of a format to create a new variable:&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=17511䑧" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=17511䑧&lt;/A&gt; (at the bottom of the post)&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 12 Apr 2011 14:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-arrays/m-p/48266#M13040</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-04-12T14:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to use arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-arrays/m-p/48267#M13041</link>
      <description>PCrider,&lt;BR /&gt;
&lt;BR /&gt;
I don't think you'll need array for this. I agree with Cynthia on proc format. Below is a quick code I wrote, hope it helps. Don't forget to edit/complete the conversion list in proc format.&lt;BR /&gt;
&lt;BR /&gt;
Best,&lt;BR /&gt;
&lt;BR /&gt;
George&lt;BR /&gt;
-----------------------------&lt;BR /&gt;
proc format;&lt;BR /&gt;
value $grade 'A' = 4 'A-' = 3.7 'B+' = 3.4 'B' = 3 'C+' = 2.3 'C' =2 'D+' = 1.3;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data GPA;&lt;BR /&gt;
infile 'H:\Personal\GPA.txt' dlm=',';&lt;BR /&gt;
input coursenum $:9. credit :2. grade $:2.;&lt;BR /&gt;
point_grade = put (grade, $grade.);&lt;BR /&gt;
gpa = point_grade * credit;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data = gpa;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 12 Apr 2011 18:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-arrays/m-p/48267#M13041</guid>
      <dc:creator>GeorgeLee</dc:creator>
      <dc:date>2011-04-12T18:28:13Z</dc:date>
    </item>
  </channel>
</rss>

