<?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: Solving Triangle Problems with SAS Program in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-New-Variable-with-a-given-table/m-p/186243#M265672</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Given a character variable Y&lt;/STRONG&gt;&lt;/SPAN&gt; of length 1,&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt; create a new variable X7&lt;/STRONG&gt;&lt;/SPAN&gt; storing values as defined in the following table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;Mapping values are in the table. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;You're being asked to recode a variable. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;Google: recode variable site:lexjansen.com&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Feb 2014 15:22:57 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-02-25T15:22:57Z</dc:date>
    <item>
      <title>Creating New Variable with a given table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-New-Variable-with-a-given-table/m-p/186241#M265670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;Given a character variable Y of length 1, create a new variable X7 storing values as defined in the following table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="174" style="border: 1px solid #000000; width: 254px; height: 158px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="padding: 2px; text-align: center; color: #ffffff; background-color: #6690bc;" valign="middle"&gt;&lt;STRONG&gt;Y&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="padding: 2px; text-align: center; color: #ffffff; background-color: #6690bc;" valign="middle"&gt;&lt;STRONG&gt;X8&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;'E'&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;'East'&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;'S'&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;'South'&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;'W'&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;'West'&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;'N'&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;'North'&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;Other Value&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: center;"&gt;''&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;I am just a beginner with SAS. &lt;BR /&gt;I tried this question, but I keep failing...:smileycry: The major problem is that I don't know what this question is telling me to do.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;Data &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;g;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;y= &lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1 &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;amp; &lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; Y = &lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;then &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;; E = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt;"&gt;'East'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;; S=&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt;"&gt;"South"&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;; W = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt;"&gt;'WEST'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;N = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt;"&gt;'North'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;else &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; Y &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;then &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;; Other_Value = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New'; font-size: 10pt;"&gt;''&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 115%; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; line-height: 115%; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; line-height: 115%; font-family: 'Courier New'; font-size: 10pt;"&gt;Failing miserably...S.O.S!!! :smileycry:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 14:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-New-Variable-with-a-given-table/m-p/186241#M265670</guid>
      <dc:creator>Takumi</dc:creator>
      <dc:date>2014-02-25T14:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Solving Triangle Problems with SAS Program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-New-Variable-with-a-given-table/m-p/186242#M265671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it not just asking you to do an if statement (or case for that matter).&amp;nbsp; I.e. if Y which is of type charater, length of 1, has the single character 'E' as value, then in variable X7 should contain 'East'.&amp;nbsp; So:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data with_additional_variable;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set rawdata;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib x7 format=$20.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if y='E' then x7='East';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if y='W' then x7='West';&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;Alternatively maybe they are asking you to create a format and apply it:&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value $compass 'E'='East' 'W'='West' 'S'='South' 'N'='North';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data with_additional_variable;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set rawdata (rename=(y=x7));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format x7 $compass.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note - I realize there are many ways of doing this, if/then/else, select case etc.&amp;nbsp; This just seems to be the most basic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 14:49:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-New-Variable-with-a-given-table/m-p/186242#M265671</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-02-25T14:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Solving Triangle Problems with SAS Program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-New-Variable-with-a-given-table/m-p/186243#M265672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Given a character variable Y&lt;/STRONG&gt;&lt;/SPAN&gt; of length 1,&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt; create a new variable X7&lt;/STRONG&gt;&lt;/SPAN&gt; storing values as defined in the following table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;Mapping values are in the table. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;You're being asked to recode a variable. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: TimesNewRomanPSMT;"&gt;Google: recode variable site:lexjansen.com&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 15:22:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-New-Variable-with-a-given-table/m-p/186243#M265672</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-02-25T15:22:57Z</dc:date>
    </item>
  </channel>
</rss>

