<?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 replace the old variable with new variable in proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/replace-the-old-variable-with-new-variable-in-proc-sql/m-p/26961#M4835</link>
    <description>I would like to replace variable X with the new value that came from case select statement.&lt;BR /&gt;
&lt;BR /&gt;
SAS give me the WARNING (below) and it keep the old variable instead of  giving me the new variable , can anyone please let me know how can I replace the new value to the same variable "X" ?&lt;BR /&gt;
&lt;BR /&gt;
--------------------------------------------------------------------------------------------------&lt;BR /&gt;
WARNING: Variable is_react already exists on file T2&lt;BR /&gt;
--------------------------------------------------------------------------------------------------&lt;BR /&gt;
proc sql;&lt;BR /&gt;
&lt;BR /&gt;
create table T2 as select &lt;BR /&gt;
&lt;BR /&gt;
case when x = 'no' then 'newVar1'&lt;BR /&gt;
else 'newVar2' end as x &lt;BR /&gt;
&lt;BR /&gt;
from T1; quit;&lt;BR /&gt;
&lt;BR /&gt;
---------------------------------------------------------------------------------------------------&lt;BR /&gt;
Thank you,&lt;BR /&gt;
Jeannie</description>
    <pubDate>Tue, 02 Nov 2010 18:05:22 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-11-02T18:05:22Z</dc:date>
    <item>
      <title>replace the old variable with new variable in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replace-the-old-variable-with-new-variable-in-proc-sql/m-p/26961#M4835</link>
      <description>I would like to replace variable X with the new value that came from case select statement.&lt;BR /&gt;
&lt;BR /&gt;
SAS give me the WARNING (below) and it keep the old variable instead of  giving me the new variable , can anyone please let me know how can I replace the new value to the same variable "X" ?&lt;BR /&gt;
&lt;BR /&gt;
--------------------------------------------------------------------------------------------------&lt;BR /&gt;
WARNING: Variable is_react already exists on file T2&lt;BR /&gt;
--------------------------------------------------------------------------------------------------&lt;BR /&gt;
proc sql;&lt;BR /&gt;
&lt;BR /&gt;
create table T2 as select &lt;BR /&gt;
&lt;BR /&gt;
case when x = 'no' then 'newVar1'&lt;BR /&gt;
else 'newVar2' end as x &lt;BR /&gt;
&lt;BR /&gt;
from T1; quit;&lt;BR /&gt;
&lt;BR /&gt;
---------------------------------------------------------------------------------------------------&lt;BR /&gt;
Thank you,&lt;BR /&gt;
Jeannie</description>
      <pubDate>Tue, 02 Nov 2010 18:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replace-the-old-variable-with-new-variable-in-proc-sql/m-p/26961#M4835</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-11-02T18:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: replace the old variable with new variable in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replace-the-old-variable-with-new-variable-in-proc-sql/m-p/26962#M4836</link>
      <description>it worked ok for me:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data t1;&lt;BR /&gt;
input x $1-5;&lt;BR /&gt;
datalines;&lt;BR /&gt;
no&lt;BR /&gt;
yes&lt;BR /&gt;
no&lt;BR /&gt;
yes&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
&lt;BR /&gt;
create table T2 as select &lt;BR /&gt;
&lt;BR /&gt;
case when x = 'no' then 'newVar1'&lt;BR /&gt;
else 'newVar2' end as x &lt;BR /&gt;
&lt;BR /&gt;
from T1; quit;</description>
      <pubDate>Tue, 02 Nov 2010 18:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replace-the-old-variable-with-new-variable-in-proc-sql/m-p/26962#M4836</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-11-02T18:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: replace the old variable with new variable in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replace-the-old-variable-with-new-variable-in-proc-sql/m-p/26963#M4837</link>
      <description>I finally figured it out, I was actually had &lt;BR /&gt;
&lt;BR /&gt;
select * prior the case when statement , so when I was trying to replace the old variable it gave me the warning, so what I did was putting the case when before the * .. &lt;BR /&gt;
&lt;BR /&gt;
and it worked just fine.&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot!!</description>
      <pubDate>Tue, 02 Nov 2010 20:20:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replace-the-old-variable-with-new-variable-in-proc-sql/m-p/26963#M4837</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-11-02T20:20:06Z</dc:date>
    </item>
  </channel>
</rss>

