<?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: Variable pubIndCode_id has been defined as both character and numeric. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593142#M76038</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105695"&gt;@Afor910327&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So this makes sense, but is there a way to manipulate the code I pasted and force those columns to be either character or numeric?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Ideally, you do this when the data enters the SAS realm. So you should look at that part of the process.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2019 17:34:38 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-10-01T17:34:38Z</dc:date>
    <item>
      <title>ERROR: Variable pubIndCode_id has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593036#M76025</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Good morning, &lt;BR /&gt;&lt;BR /&gt;In a simple way, how could I correct this mistake?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------------------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;data indwts_and_empratios0;
 merge inds_empout rims_both3(in=inb);
  by pubIndCode_id;
  if inb;


1270  data indwts_and_empratios0;
1271   merge inds_empout rims_both3(in=inb);
&lt;STRONG&gt;ERROR: Variable pubIndCode_id has been defined as both character and numeric.&lt;/STRONG&gt;1272    by pubIndCode_id;
1273    if inb;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593036#M76025</guid>
      <dc:creator>Afor910327</dc:creator>
      <dc:date>2019-10-01T14:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable pubIndCode_id has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593039#M76026</link>
      <description>&lt;P&gt;It means that your "by" variable is defined in the incoming datasets with different types (character and numeric). You need to properly convert it to the correct type in one of the datasets for the merge to work.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593039#M76026</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-01T14:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable pubIndCode_id has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593041#M76027</link>
      <description>&lt;P&gt;You need to decide if&amp;nbsp;pubIndCode_id should be a number or a character string. Since it ends with _ID it probably should be a character variable.&amp;nbsp; You don't need to perform arithmetic on ID values.&lt;/P&gt;
&lt;P&gt;Then figure out which of the two datasets has the variable defined as a number and fix that.&amp;nbsp; Preferable by changing the process that created the dataset.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:08:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593041#M76027</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-01T14:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable pubIndCode_id has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593046#M76028</link>
      <description>&lt;P&gt;So this makes sense, but is there a way to manipulate the code I pasted and force those columns to be either character or numeric?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593046#M76028</guid>
      <dc:creator>Afor910327</dc:creator>
      <dc:date>2019-10-01T14:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable pubIndCode_id has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593050#M76029</link>
      <description>&lt;P&gt;You cannot do it easily if it is the BY variable.&amp;nbsp; &amp;nbsp;You will need to make an updated version of one of the datasets and possible re-sort it since numbers and character strings could sort in different orders.&amp;nbsp; Although it is normally better to use character for ID varaibles it is probably easier to convert the character version to numeric since then leading zeros or leading spaces will not cause confusion.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fix ;
  set oldA (rename=(old_var=old_var_char));
  old_var = input(old_var_char,32.);
run;
proc sort data=fix; by old_var; run;

data want;
  merge fix oldB;
  by old_var;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If it is some other variable then here is a work around that does not require that you know which dataset has the numeric and which has the character variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  merge A (in=ina rename=(old_var=old_var_A))
       B(in=inb rename=(old_var=old_var_b));
  by some_other_variable;
  old_var = input(coalescec(cats(old_var_b),cats(old_var_a)),32.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 14:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593050#M76029</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-01T14:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable pubIndCode_id has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593084#M76033</link>
      <description>&lt;P&gt;SQL allows you to change types in the "Merge/Join" step, but a data step does not.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know which is character or which is numeric but you can use PUT to convert the numeric variable to a character though you'll want to test that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

proc sql;
create table want as
select *
from rims_both as rb
left join inds_empout as ie
on put(rb.pubIndCode_ID, $8. -l) = ie.pubIndCode_ID;

quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105695"&gt;@Afor910327&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So this makes sense, but is there a way to manipulate the code I pasted and force those columns to be either character or numeric?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 16:10:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593084#M76033</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-10-01T16:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable pubIndCode_id has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593115#M76036</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105695"&gt;@Afor910327&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So this makes sense, but is there a way to manipulate the code I pasted and force those columns to be either character or numeric?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is not uncommon for variables used in an identification role, like bank accounts, to have leading zeroes. You may have to spend some time deciding if that is the case for your data as there may be more complications getting the correct number of leading zeroes than you expect depending on your actual values. If the lengths of your character values vary and have leading zeroes you may find it easier to re-read the external data source with the matching length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 16:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593115#M76036</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-10-01T16:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable pubIndCode_id has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593142#M76038</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105695"&gt;@Afor910327&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So this makes sense, but is there a way to manipulate the code I pasted and force those columns to be either character or numeric?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Ideally, you do this when the data enters the SAS realm. So you should look at that part of the process.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 17:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Variable-pubIndCode-id-has-been-defined-as-both-character/m-p/593142#M76038</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-01T17:34:38Z</dc:date>
    </item>
  </channel>
</rss>

