<?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: getting error message: variable defined as both character and numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/getting-error-message-variable-defined-as-both-character-and/m-p/502742#M134255</link>
    <description>&lt;P&gt;First of all, this is not a merge, it's a simple sequential set.&lt;/P&gt;
&lt;P&gt;And yes, you need to have all variables of the same name to be of the same type (same length is not a must, but very advisable!).&lt;/P&gt;
&lt;P&gt;So inspect your datasets and make the necessary changes before concatenating them.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Oct 2018 15:05:58 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-10-09T15:05:58Z</dc:date>
    <item>
      <title>getting error message: variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/getting-error-message-variable-defined-as-both-character-and/m-p/502728#M134245</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am merging 22 years of data sets in SAS 9.4 and I am getting several error statements saying variables such as sex, race, zipcode are defined a both character and numeric.&lt;/P&gt;&lt;P&gt;sex is M(male), F(female), U(unknown)&lt;/P&gt;&lt;P&gt;race is c 1(AIAN), 2(A), 3(BAA), 4(NHOPI), 5(W), 6(O), 7(U)&lt;/P&gt;&lt;P&gt;zipcode is continuous numbers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will I have to rename these variables in each data set before I merge them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was my merging code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data IHD9214;
set Ahca.Ihd1992 Ahca.Ihd1993 Ahca.Ihd1994 Ahca.Ihd1995 Ahca.Ihd1996 Ahca.Ihd1997 Ahca.Ihd1998 Ahca.Ihd1999 Ahca.Ihd2000 Ahca.Ihd2001 Ahca.Ihd2002 Ahca.Ihd2003 Ahca.Ihd2004 Ahca.Ihd2005 Ahca.Ihd2006 Ahca.Ihd2007 Ahca.Ihd2008 Ahca.Ihd2009 Ahca.Ihd2010 Ahca.Ihd2011 Ahca.Ihd2012 Ahca.Ihd2013 Ahca.Ihd2014;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 14:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/getting-error-message-variable-defined-as-both-character-and/m-p/502728#M134245</guid>
      <dc:creator>crc7rb</dc:creator>
      <dc:date>2018-10-09T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: getting error message: variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/getting-error-message-variable-defined-as-both-character-and/m-p/502742#M134255</link>
      <description>&lt;P&gt;First of all, this is not a merge, it's a simple sequential set.&lt;/P&gt;
&lt;P&gt;And yes, you need to have all variables of the same name to be of the same type (same length is not a must, but very advisable!).&lt;/P&gt;
&lt;P&gt;So inspect your datasets and make the necessary changes before concatenating them.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 15:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/getting-error-message-variable-defined-as-both-character-and/m-p/502742#M134255</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-09T15:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: getting error message: variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/getting-error-message-variable-defined-as-both-character-and/m-p/502763#M134265</link>
      <description>Do all the files have the same variables and types? Did you happen to import these files from an XLSX or CSV/txt file? &lt;BR /&gt;</description>
      <pubDate>Tue, 09 Oct 2018 15:37:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/getting-error-message-variable-defined-as-both-character-and/m-p/502763#M134265</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-09T15:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: getting error message: variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/getting-error-message-variable-defined-as-both-character-and/m-p/502788#M134275</link>
      <description>&lt;P&gt;This code may be useful in indicating which variable/datasets you need to be concerned with. It will create a report table with an X indicating which datasets have a variable of which type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
   value x
   1='X'
   ;
proc tabulate data=sashelp.vcolumn;
  where libname='AHCA';
  class memname name type;
  tables name*type,
         memname*n=''*f=x.
        /misstext=' ';
run;&lt;/PRE&gt;
&lt;P&gt;If these sets came from a common structure and were read with proc import then you may want to go back to reading the data with a method that will set consistent types and lengths.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your error is likely to have issues with data truncation do to length differences as well.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 16:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/getting-error-message-variable-defined-as-both-character-and/m-p/502788#M134275</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-09T16:33:17Z</dc:date>
    </item>
  </channel>
</rss>

