<?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 HERD has been defined as both character and numeric. BY USING MERGE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548638#M152159</link>
    <description>How did you create these data sets initially? Did you verify the variable types were imported correctly and what you need?&lt;BR /&gt;&lt;BR /&gt;If you imported these files via CSV or a text data set its better to go back to that step and fix it there.  If not, youc an convert to a new variable but you need to rename it before you bring it in.&lt;BR /&gt;&lt;BR /&gt;data county;&lt;BR /&gt;set oldData (rename = Herd=OldHerd);&lt;BR /&gt;*convert to numeric;&lt;BR /&gt;Herd =input(herd, 8.);&lt;BR /&gt;drop oldHerd;&lt;BR /&gt;run;</description>
    <pubDate>Thu, 04 Apr 2019 20:10:34 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-04-04T20:10:34Z</dc:date>
    <item>
      <title>ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548565#M152119</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I got error by using both of theses codes in order to merge two datasets &lt;BR /&gt;
Data data2004;
merge d2004 county; by herd; run; quit; 

data Data2004;
merge D2004(IN=K) county(IN=Q); 
if K and Q; by herd; run; quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and this the log:&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;355 data Data2004;&lt;BR /&gt;356 merge D2004(IN=K) county(IN=Q);&lt;BR /&gt;ERROR: Variable HERD has been defined as both character and numeric.&lt;BR /&gt;357 if K and Q; by herd; run;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ibrahim&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Apr 2019 17:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548565#M152119</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2019-04-04T17:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548567#M152121</link>
      <description>&lt;P&gt;I think the error message is relatively clear. You have to fix the problem so in both data sets HERD is numeric, or in both data sets HERD is character.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 17:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548567#M152121</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-04T17:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548568#M152122</link>
      <description>&lt;P&gt;How did you create these data sets initially? Did you verify the variable types were imported correctly and what you need?&lt;BR /&gt;If not, you need to go back and do that step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/151600"&gt;@Barkamih&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I got error by using both of theses codes in order to merge two datasets &lt;BR /&gt;
Data data2004;
merge d2004 county; by herd; run; quit; 

data Data2004;
merge D2004(IN=K) county(IN=Q); 
if K and Q; by herd; run; quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and this the log:&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;355 data Data2004;&lt;BR /&gt;356 merge D2004(IN=K) county(IN=Q);&lt;BR /&gt;ERROR: Variable HERD has been defined as both character and numeric.&lt;BR /&gt;357 if K and Q; by herd; run;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;regards&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ibrahim&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 17:08:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548568#M152122</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-04T17:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548633#M152156</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to make it correct?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data county;
herd = '             ';
new_herd = input(herd,               );
drop herd;
rename new_herd = herd;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 20:02:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548633#M152156</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2019-04-04T20:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548634#M152157</link>
      <description>&lt;P&gt;Provide example data, so we can guide you to the correct informat.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 19:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548634#M152157</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-04T19:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548636#M152158</link>
      <description>&lt;P&gt;i did this code but to convert the variable, but how to complete it correctly?&lt;BR /&gt;data county;&lt;BR /&gt;herd = ' ';&lt;BR /&gt;new_herd = input(herd, );&lt;BR /&gt;drop herd;&lt;BR /&gt;rename new_herd = herd;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 09:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548636#M152158</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2019-04-05T09:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548638#M152159</link>
      <description>How did you create these data sets initially? Did you verify the variable types were imported correctly and what you need?&lt;BR /&gt;&lt;BR /&gt;If you imported these files via CSV or a text data set its better to go back to that step and fix it there.  If not, youc an convert to a new variable but you need to rename it before you bring it in.&lt;BR /&gt;&lt;BR /&gt;data county;&lt;BR /&gt;set oldData (rename = Herd=OldHerd);&lt;BR /&gt;*convert to numeric;&lt;BR /&gt;Herd =input(herd, 8.);&lt;BR /&gt;drop oldHerd;&lt;BR /&gt;run;</description>
      <pubDate>Thu, 04 Apr 2019 20:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548638#M152159</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-04T20:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548661#M152175</link>
      <description>&lt;P&gt;Which informat you have to use in the input() function depends on the contents of herd. That's why we need examples.&lt;/P&gt;
&lt;P&gt;In many cases, the BESTw. informat can work.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 06:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548661#M152175</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-05T06:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548688#M152184</link>
      <description>&lt;P&gt;you need to fix the data type in your contributing tables, there is no issue with your merge code&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 05:20:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548688#M152184</guid>
      <dc:creator>Shivam</dc:creator>
      <dc:date>2019-04-05T05:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548738#M152209</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I'm really sorry about that, I was so busy yesterday,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is an example of the herd variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so, I have big&amp;nbsp;data that has these numbers and I want to merge some information to these file&amp;nbsp;by a herd.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Herd number means Farm name or farm id,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got these data in excel file form a company.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data was imported to SAS as a CSV file type.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm really confused about how to merge these file together.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards to everyone&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ibrahim&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Herd 
5179940
5180223
5599499
60001827
390464233
700114030
1206840374&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Apr 2019 11:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548738#M152209</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2019-04-05T11:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548751#M152215</link>
      <description>&lt;P&gt;It doesn't help if you type in the data from ONE of the data sets. Typing in the data doesn't help anyway. You have to show us the code that shows how BOTH (not one) data sets were created. Or show us PROC CONTENTS output of BOTH data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 12:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548751#M152215</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-05T12:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548756#M152218</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/151600"&gt;@Barkamih&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data was imported to SAS as a CSV file type.&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since you are reading from a text file you can have complete control over how the variables are created.&lt;/P&gt;
&lt;P&gt;You probably used PROC IMPORT to read the files.&amp;nbsp; That will just generate a data step to read the file.&amp;nbsp; Copy the data steps and modify the definition of HERD to be the same for both.&amp;nbsp; Then re-run the modified data steps and now your HERD variable will be compatible.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 13:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548756#M152218</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-05T13:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548766#M152222</link>
      <description>&lt;P&gt;&amp;nbsp;this is data county&amp;nbsp;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Alphabetic List of Variables and Attributes# Variable Type Len Format Informat&amp;nbsp;1 &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;herd&lt;/TD&gt;&lt;TD&gt;Num&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;BEST12.&lt;/TD&gt;&lt;TD&gt;BEST32.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Sort InformationSortedbyValidatedCharacter Set &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;herd&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ANSI&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;this is data d 2004&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Alphabetic List of Variables and Attributes# Variable Type Len Format Informat&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;1 &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;HERD&lt;/TD&gt;&lt;TD&gt;Char&lt;/TD&gt;&lt;TD&gt;42&lt;/TD&gt;&lt;TD&gt;$42.&lt;/TD&gt;&lt;TD&gt;$42.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 Apr 2019 13:51:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548766#M152222</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2019-04-05T13:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Variable HERD has been defined as both character and numeric. BY USING MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548769#M152223</link>
      <description>&lt;P&gt;Given your data, a big enough w. informat (eg 12.) will do it. But if you start from a csv file, the optimal way is reading the column as numeric in the first place.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 13:55:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Variable-HERD-has-been-defined-as-both-character-and/m-p/548769#M152223</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-05T13:55:10Z</dc:date>
    </item>
  </channel>
</rss>

