<?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 Create a new variable based on flag indicator in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-based-on-flag-indicator/m-p/771267#M244707</link>
    <description>&lt;P&gt;I have towns in a dataset flagged with "*" or nothing (" ")&lt;/P&gt;&lt;P&gt;I want to create a new variable called&lt;STRONG&gt; location&lt;/STRONG&gt; where "*"= "north" and " "= "south"&lt;/P&gt;&lt;P&gt;When I do this code, it codes " " to "south" but not "*" to "north"&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class4.water;
if flag="*" then location="north";
else if flag="" then location="south";
run; &lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="westbestern_0-1632964474471.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64240iB773E0A9102191CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="westbestern_0-1632964474471.png" alt="westbestern_0-1632964474471.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Why is that happening? What can I do in my code to fix it?&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 30 Sep 2021 01:15:05 GMT</pubDate>
    <dc:creator>westbestern</dc:creator>
    <dc:date>2021-09-30T01:15:05Z</dc:date>
    <item>
      <title>Create a new variable based on flag indicator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-based-on-flag-indicator/m-p/771267#M244707</link>
      <description>&lt;P&gt;I have towns in a dataset flagged with "*" or nothing (" ")&lt;/P&gt;&lt;P&gt;I want to create a new variable called&lt;STRONG&gt; location&lt;/STRONG&gt; where "*"= "north" and " "= "south"&lt;/P&gt;&lt;P&gt;When I do this code, it codes " " to "south" but not "*" to "north"&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class4.water;
if flag="*" then location="north";
else if flag="" then location="south";
run; &lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="westbestern_0-1632964474471.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64240iB773E0A9102191CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="westbestern_0-1632964474471.png" alt="westbestern_0-1632964474471.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Why is that happening? What can I do in my code to fix it?&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Sep 2021 01:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-based-on-flag-indicator/m-p/771267#M244707</guid>
      <dc:creator>westbestern</dc:creator>
      <dc:date>2021-09-30T01:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable based on flag indicator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-based-on-flag-indicator/m-p/771270#M244710</link>
      <description>&lt;P&gt;This step works as it should.&amp;nbsp; There is no SET statement, so no data is being brought in.&amp;nbsp; I hope you have a way of re-creating CLASS4.WATER, because running this program just wiped it out, replacing it with a single observation and no data other than what you are observing.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 01:42:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-based-on-flag-indicator/m-p/771270#M244710</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-09-30T01:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable based on flag indicator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-based-on-flag-indicator/m-p/771410#M244796</link>
      <description>&lt;P&gt;need to post data so we can help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 16:06:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-based-on-flag-indicator/m-p/771410#M244796</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-09-30T16:06:08Z</dc:date>
    </item>
  </channel>
</rss>

