<?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: creating new variable from a variable with names in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/creating-new-variable-from-a-variable-with-names/m-p/763745#M10144</link>
    <description>&lt;P&gt;Since I never download attachments, I'll take a guess here&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    if upcase(d_religion)='CATHOLIC' then d_religion2='CHRISTIAN';
    else if upcase(d_religion)='BUDDHIST' then d_religion2='INDIAN';
    /* And so on */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The proper way to provide sample data is &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Aug 2021 21:34:48 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-08-24T21:34:48Z</dc:date>
    <item>
      <title>creating new variable from a variable with names</title>
      <link>https://communities.sas.com/t5/SAS-Studio/creating-new-variable-from-a-variable-with-names/m-p/763744#M10143</link>
      <description>&lt;P&gt;I'm creating a new variable, d_religion2 from an existing variable, d_religion. All I'm trying to do is redefine the categories of the variable (should be super easy, right?). In the dataset I'm working with, the categories of d_religion are words - catholic, evangelical, jewish, etc. - I attached a screen shot of a table of d_religion so you can see what I mean. How do I write that in an if/then statement? Because writing something like "if d_religion=catholic then d_religion2=christian;" for example, doesn't work. Hopefully this is clear......let me know if you have questions. I know this is probably simple haha. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 21:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/creating-new-variable-from-a-variable-with-names/m-p/763744#M10143</guid>
      <dc:creator>joachimg</dc:creator>
      <dc:date>2021-08-24T21:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: creating new variable from a variable with names</title>
      <link>https://communities.sas.com/t5/SAS-Studio/creating-new-variable-from-a-variable-with-names/m-p/763745#M10144</link>
      <description>&lt;P&gt;Since I never download attachments, I'll take a guess here&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    if upcase(d_religion)='CATHOLIC' then d_religion2='CHRISTIAN';
    else if upcase(d_religion)='BUDDHIST' then d_religion2='INDIAN';
    /* And so on */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The proper way to provide sample data is &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 21:34:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/creating-new-variable-from-a-variable-with-names/m-p/763745#M10144</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-24T21:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: creating new variable from a variable with names</title>
      <link>https://communities.sas.com/t5/SAS-Studio/creating-new-variable-from-a-variable-with-names/m-p/763746#M10145</link>
      <description>Amazing! Glad it was a command I haven't learned yet and not just me being dumb..... thank you so much! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 24 Aug 2021 21:45:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/creating-new-variable-from-a-variable-with-names/m-p/763746#M10145</guid>
      <dc:creator>joachimg</dc:creator>
      <dc:date>2021-08-24T21:45:50Z</dc:date>
    </item>
  </channel>
</rss>

