<?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 Variable EmpId has been defined as both character and numeric. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-EmpId-has-been-defined-as-both-character-and-numeric/m-p/280675#M56752</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my code&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;options pagesize=60 linesize=80 pageno=1 nodate;

data new_accounting (rename = (TempVar =EmpId) drop= EmpId);
	set accounting;
	TempVar = put(EmpId,$9.);
run;

proc datasets library=work;
	contents data = new_accounting;
run;


data dept1_4;
	set sales CustomerSupport Security new_accounting ;
run;
proc print data=dept1_4;
title 'Employees in Sales, Customer Support, Security,';
title2 'and Accounting Departments';
run;&lt;/CODE&gt;&lt;/PRE&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;data shipping;
	input EmpId 1-9 EmpName $ 11-29 Gender $ 30 @32 HireDate date9. @42 Salary;
	format HireDate date7.
		   Salary comma6.;
	datalines;
688774609 Carlton, Susan     F 28jan1995 29200
922448328 Hoffmann, Gerald   M 12oct1997 27600
544909752 DePuis, David      M 23aug1994 32900
745609821 Hahn, Kenneth      M 23aug1994 33300
634774295 Landau, Jennifer   F 30apr1996 32900
;
run;

proc print data = shipping;
	title ' Shipping details';
run;

data dept5_1;
	set shipping new_accounting Security sales CustomerSupport;
run;

proc print data = dept5_1;
	title ' Employees in Shipping, Accounting, Security,';
	title2 ' Customer Support, and Sales Departments';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;203        
 204        data dept5_1;
 205        set shipping new_accounting Security sales CustomerSupport;
 ERROR: Variable EmpId has been defined as both character and numeric.
 206        run;
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&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;PRE&gt;&lt;CODE class=" language-sas"&gt; NOTE: PROCEDURE DATASETS used (Total process time):
       real time           0.08 seconds
       cpu time            0.08 seconds
       
 176        data dept1_4;
 
 177        set sales CustomerSupport Security new_accounting ;
 ERROR: Variable EmpId has been defined as both character and numeric.
 178        run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jun 2016 06:56:59 GMT</pubDate>
    <dc:creator>francisca</dc:creator>
    <dc:date>2016-06-28T06:56:59Z</dc:date>
    <item>
      <title>Variable EmpId has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-EmpId-has-been-defined-as-both-character-and-numeric/m-p/280675#M56752</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my code&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;options pagesize=60 linesize=80 pageno=1 nodate;

data new_accounting (rename = (TempVar =EmpId) drop= EmpId);
	set accounting;
	TempVar = put(EmpId,$9.);
run;

proc datasets library=work;
	contents data = new_accounting;
run;


data dept1_4;
	set sales CustomerSupport Security new_accounting ;
run;
proc print data=dept1_4;
title 'Employees in Sales, Customer Support, Security,';
title2 'and Accounting Departments';
run;&lt;/CODE&gt;&lt;/PRE&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;data shipping;
	input EmpId 1-9 EmpName $ 11-29 Gender $ 30 @32 HireDate date9. @42 Salary;
	format HireDate date7.
		   Salary comma6.;
	datalines;
688774609 Carlton, Susan     F 28jan1995 29200
922448328 Hoffmann, Gerald   M 12oct1997 27600
544909752 DePuis, David      M 23aug1994 32900
745609821 Hahn, Kenneth      M 23aug1994 33300
634774295 Landau, Jennifer   F 30apr1996 32900
;
run;

proc print data = shipping;
	title ' Shipping details';
run;

data dept5_1;
	set shipping new_accounting Security sales CustomerSupport;
run;

proc print data = dept5_1;
	title ' Employees in Shipping, Accounting, Security,';
	title2 ' Customer Support, and Sales Departments';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;203        
 204        data dept5_1;
 205        set shipping new_accounting Security sales CustomerSupport;
 ERROR: Variable EmpId has been defined as both character and numeric.
 206        run;
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&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;PRE&gt;&lt;CODE class=" language-sas"&gt; NOTE: PROCEDURE DATASETS used (Total process time):
       real time           0.08 seconds
       cpu time            0.08 seconds
       
 176        data dept1_4;
 
 177        set sales CustomerSupport Security new_accounting ;
 ERROR: Variable EmpId has been defined as both character and numeric.
 178        run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 06:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-EmpId-has-been-defined-as-both-character-and-numeric/m-p/280675#M56752</guid>
      <dc:creator>francisca</dc:creator>
      <dc:date>2016-06-28T06:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Variable EmpId has been defined as both character and numeric.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-EmpId-has-been-defined-as-both-character-and-numeric/m-p/280678#M56754</link>
      <description>&lt;P&gt;With this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new_accounting (rename = (TempVar =EmpId) drop= EmpId);
	set accounting;
	TempVar = put(EmpId,$9.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you have specifically created tempvar as character (because of using a character format in the put statement) and then replaced empid with the newly defined character variable.&lt;/P&gt;
&lt;P&gt;Here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data shipping;
	input EmpId 1-9 EmpName $ 11-29 Gender $ 30 @32 HireDate date9. @42 Salary;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you do not specify empid to be character, therefore SAS creates it as numeric.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 07:04:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-EmpId-has-been-defined-as-both-character-and-numeric/m-p/280678#M56754</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-06-28T07:04:14Z</dc:date>
    </item>
  </channel>
</rss>

