<?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: Variable uninitialized in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589656#M7972</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290816"&gt;@nikky&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would need to make recoded values a constant operand within &lt;EM&gt;&lt;STRONG&gt;"quotes"&lt;/STRONG&gt;&lt;/EM&gt; rather than variable operand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For eg&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if 0&amp;lt;gpa&amp;lt;0.5 then LetterGrade="F";&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Sep 2019 14:01:28 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-09-18T14:01:28Z</dc:date>
    <item>
      <title>Variable uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589654#M7971</link>
      <description>&lt;P&gt;I am trying to create a new variable LetterGrade with recoding GPA into alphabets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I keep recieving the message saying variable uninitialized. Below is my code in SAS Studio&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please Help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;*Creating new variable based on Letter grade;&lt;BR /&gt;data Lgrades;&lt;BR /&gt;set students_additional;&lt;BR /&gt;  if 0&amp;lt;gpa&amp;lt;0.5 then LetterGrade=F;&lt;BR /&gt;  else if 0.5&amp;lt;gpa&amp;lt;1.5 then LetterGrade=D;&lt;BR /&gt;  else if 1.5&amp;lt;gpa&amp;lt;2.5 then LetterGrade=C;&lt;BR /&gt;  else if 2.5&amp;lt;gpa&amp;lt;3.5 then LetterGrade=B;&lt;BR /&gt; else if gpa &amp;gt;=3.5 then LetterGrade=A;&lt;BR /&gt; RUN;&lt;BR /&gt; proc print data=Lgrades;&lt;BR /&gt;title 'LetterGrade Dataset';&lt;BR /&gt;run;&lt;BR /&gt;proc contents data=Lgrades;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 13:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589654#M7971</guid>
      <dc:creator>nikky</dc:creator>
      <dc:date>2019-09-18T13:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Variable uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589656#M7972</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290816"&gt;@nikky&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would need to make recoded values a constant operand within &lt;EM&gt;&lt;STRONG&gt;"quotes"&lt;/STRONG&gt;&lt;/EM&gt; rather than variable operand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For eg&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if 0&amp;lt;gpa&amp;lt;0.5 then LetterGrade="F";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Sep 2019 14:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589656#M7972</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-18T14:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Variable uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589658#M7973</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290816"&gt;@nikky&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to create a new variable LetterGrade with recoding GPA into alphabets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I keep recieving the message saying variable uninitialized. Below is my code in SAS Studio&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please Help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;*Creating new variable based on Letter grade;&lt;BR /&gt;data Lgrades;&lt;BR /&gt;set students_additional;&lt;BR /&gt;  if 0&amp;lt;gpa&amp;lt;0.5 then LetterGrade=F;&lt;BR /&gt;  else if 0.5&amp;lt;gpa&amp;lt;1.5 then LetterGrade=D;&lt;BR /&gt;  else if 1.5&amp;lt;gpa&amp;lt;2.5 then LetterGrade=C;&lt;BR /&gt;  else if 2.5&amp;lt;gpa&amp;lt;3.5 then LetterGrade=B;&lt;BR /&gt; else if gpa &amp;gt;=3.5 then LetterGrade=A;&lt;BR /&gt; RUN;&lt;BR /&gt; proc print data=Lgrades;&lt;BR /&gt;title 'LetterGrade Dataset';&lt;BR /&gt;run;&lt;BR /&gt;proc contents data=Lgrades;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What values do the variables A, B, C and D have?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or did you mean to set the variable to the character stings 'A', 'B', etc instead?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 14:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589658#M7973</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-09-18T14:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Variable uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589659#M7974</link>
      <description>&lt;P&gt;Thank you , I will do right away.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 14:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589659#M7974</guid>
      <dc:creator>nikky</dc:creator>
      <dc:date>2019-09-18T14:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Variable uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589661#M7976</link>
      <description>&lt;P&gt;Yes Tom, I do mean to have them in character form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 14:04:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589661#M7976</guid>
      <dc:creator>nikky</dc:creator>
      <dc:date>2019-09-18T14:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Variable uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589702#M7977</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290816"&gt;@nikky&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to create a new variable LetterGrade with recoding GPA into alphabets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I keep recieving the message saying variable uninitialized. Below is my code in SAS Studio&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please Help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;*Creating new variable based on Letter grade;&lt;BR /&gt;data Lgrades;&lt;BR /&gt;set students_additional;&lt;BR /&gt;  if 0&amp;lt;gpa&amp;lt;0.5 then LetterGrade=F;&lt;BR /&gt;  else if 0.5&amp;lt;gpa&amp;lt;1.5 then LetterGrade=D;&lt;BR /&gt;  else if 1.5&amp;lt;gpa&amp;lt;2.5 then LetterGrade=C;&lt;BR /&gt;  else if 2.5&amp;lt;gpa&amp;lt;3.5 then LetterGrade=B;&lt;BR /&gt; else if gpa &amp;gt;=3.5 then LetterGrade=A;&lt;BR /&gt; RUN;&lt;BR /&gt; proc print data=Lgrades;&lt;BR /&gt;title 'LetterGrade Dataset';&lt;BR /&gt;run;&lt;BR /&gt;proc contents data=Lgrades;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So what grade do you want to assign with the GPA is exactly 0, 0.5, 1.5 or&amp;nbsp;2.5 ? You are excluding the end point in every single one of your comparisons with those values. I suspect that you may want&lt;/P&gt;
&lt;PRE&gt;data Lgrades;
set students_additional;
  if 0&amp;lt;gpa&lt;STRONG&gt;&amp;lt;=&lt;/STRONG&gt;0.5 then LetterGrade='F';
  else if 0.5&amp;lt;gpa&lt;STRONG&gt;&amp;lt;=&lt;/STRONG&gt;1.5 then LetterGrade='D';
  else if 1.5&amp;lt;gpa&lt;STRONG&gt;&amp;lt;=&lt;/STRONG&gt;2.5 then LetterGrade='C';
  else if 2.5&amp;lt;gpa&amp;lt;3.5 then LetterGrade='B';
 else if gpa &amp;gt;=3.5 then LetterGrade='A';
 RUN;&lt;/PRE&gt;
&lt;P&gt;or similar&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 15:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-uninitialized/m-p/589702#M7977</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-18T15:18:59Z</dc:date>
    </item>
  </channel>
</rss>

