<?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: Error persists: changing character to numeric in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188560#M47719</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, running proc content helped in knowing the numeric and character variables. What was coming on the way of the merger was the persistence of the character variable after the new numeric variable were created. I dropped the character variables and that yielded to the merger.&amp;nbsp; Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Sep 2014 22:51:59 GMT</pubDate>
    <dc:creator>Sapkota</dc:creator>
    <dc:date>2014-09-05T22:51:59Z</dc:date>
    <item>
      <title>Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188553#M47712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am merging two datasets and one of them is in character format.&lt;/P&gt;&lt;P&gt;I applied few SAS procedures to change the character to number value before merging&lt;/P&gt;&lt;P&gt;but when I merge it still says &lt;SPAN style="color: #ff0000;"&gt;'Error: variable has been defined as both character and numeric'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;Here is what I tried, but with both of these I still get the error messages:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;data temp1; set temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;var1_n = var1*1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;var2_n=var2*1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;va3_n=var3*1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;data temp1; set temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;var1_n = input(var1, 3.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;var2_n = input (var2, 3.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;var3_n = input (var3, 3.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080;"&gt;Any help and will be appreciated. Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 17:56:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188553#M47712</guid>
      <dc:creator>Sapkota</dc:creator>
      <dc:date>2014-09-05T17:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188554#M47713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATA HAVE;&lt;BR /&gt;INPUT ID $;&lt;BR /&gt;DATALINES;&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;PROC CONTENTS DATA=HAVE; RUN;&lt;/P&gt;&lt;P&gt;DATA WANT;&lt;BR /&gt;SET HAVE;&lt;BR /&gt;ID_NEW=INPUT(ID,3.);&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;PROC CONTENTS DATA=WANT; RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="7315" alt="Capture.JPG" class="jive-image" src="https://communities.sas.com/legacyfs/online/7315_Capture.JPG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 18:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188554#M47713</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2014-09-05T18:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188555#M47714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what are you trying to merge?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 18:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188555#M47714</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2014-09-05T18:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188556#M47715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have more than the three variables shown you may be having issues with one of them.&lt;/P&gt;&lt;P&gt;You don't show any merging code so it is a tad hard to give pointers where to look.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 19:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188556#M47715</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-09-05T19:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188557#M47716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. Here is the merging code I used. Please note that the dataset 'chemicals' already has numerical values. Its only the dataset 'temp1' where values need to be converted to numeric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data merged;&lt;/P&gt;&lt;P&gt;merge temp1 (in=x) chemicals;&lt;/P&gt;&lt;P&gt;by lab_id;&lt;/P&gt;&lt;P&gt;if x;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 20:19:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188557#M47716</guid>
      <dc:creator>Sapkota</dc:creator>
      <dc:date>2014-09-05T20:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188558#M47717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to merge two different datasets of chemicals that have numeric values. Both these datasets have a common variable lab_id.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 20:21:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188558#M47717</guid>
      <dc:creator>Sapkota</dc:creator>
      <dc:date>2014-09-05T20:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188559#M47718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it is time to run proc contents on both temp and chemicals. Look for the same variable name but different data type. That would be your culprit(s).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 22:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188559#M47718</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-09-05T22:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188560#M47719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, running proc content helped in knowing the numeric and character variables. What was coming on the way of the merger was the persistence of the character variable after the new numeric variable were created. I dropped the character variables and that yielded to the merger.&amp;nbsp; Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 22:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188560#M47719</guid>
      <dc:creator>Sapkota</dc:creator>
      <dc:date>2014-09-05T22:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188561#M47720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could also just rename them on the merge&lt;/P&gt;&lt;P&gt;data example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge set1 (rename=(var1=CharVar1))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;As an example if var1 was a variable with different types.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 22:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188561#M47720</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-09-05T22:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error persists: changing character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188562#M47721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is a good option. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Sep 2014 22:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Error-persists-changing-character-to-numeric/m-p/188562#M47721</guid>
      <dc:creator>Sapkota</dc:creator>
      <dc:date>2014-09-05T22:59:16Z</dc:date>
    </item>
  </channel>
</rss>

