<?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: Variable defined as both character and numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453658#M114666</link>
    <description>&lt;P&gt;thank you much, I appreciate&amp;nbsp;that, you are done a very good jobe with me, and I'm sorry if I took you time&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks again&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Barkamih&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Apr 2018 16:57:48 GMT</pubDate>
    <dc:creator>Barkamih</dc:creator>
    <dc:date>2018-04-12T16:57:48Z</dc:date>
    <item>
      <title>Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453619#M114649</link>
      <description>&lt;P&gt;&amp;nbsp;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have a problem when I run this code in order to combine two datasets together by using this code, Calving_ease is the issue, this code can present only the number of calving_ease of the first dataset, but the numbers of calving_ease&amp;nbsp; in the second dataset are all missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  dataall;

set data48 data910(rename=(calving_ease=calving_easenum));

calving_ease = put(calving_ease, 7.);

drop calving_easenum;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Apr 2018 15:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453619#M114649</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-04-12T15:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453626#M114653</link>
      <description>&lt;P&gt;In dataset date48 you have a variable called calving_ease, in data910 you also have this, however you rename it to calving_easenum&amp;nbsp; Now when these two datasets are set together the output creates a variable called calving_ease which holds the data from the first table, and fills in empties from the second, as that variable does not exist.&amp;nbsp; This is the logic you have presented below, and hence that is what is achieved at the end.&amp;nbsp; I cannot guess what you are trying to do, nor can I understand why your thread topic is char vs num but that is not what the question you present is.&amp;nbsp; A quick check on the guidance when presenting questions would help, present test data in the form of a datastep, show what you want out at the end.&amp;nbsp; I am going to guess that in one dataset calving_ease is character, and the other is numeric?&amp;nbsp; If so convert one or the other before setting.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 15:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453626#M114653</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-12T15:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453632#M114655</link>
      <description>&lt;P&gt;yeas&amp;nbsp;&lt;/P&gt;&lt;P&gt;your&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;guess is right because I had this issue I did this code,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;the normal code for&amp;nbsp; combining&amp;nbsp; data is this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data all;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set data1 data2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;but I have an error with the code as the calvng_ease defined as both character&amp;nbsp;and numeric.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so I tried to do it by the previous&amp;nbsp;code that I posted,&amp;nbsp; but I got&amp;nbsp;missing data for the second dataset&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453632#M114655</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-04-12T16:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453637#M114657</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/151600"&gt;@Barkamih&lt;/a&gt;&amp;nbsp;you need to convert one of the variables to either character or numeric to make it consistent for successful append&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453637#M114657</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-12T16:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453643#M114659</link>
      <description>&lt;P&gt;could you please provide an example code, how to convert it ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453643#M114659</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-04-12T16:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453645#M114661</link>
      <description>&lt;P&gt;I made a small correction to your code:&lt;/P&gt;&lt;P&gt;assuming&amp;nbsp; calving_ease in 48 is character and 910 needs to become character&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try and let me know&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  dataall;

set data48 data910(in=b rename=(calving_ease=calving_easenum));

if b then calving_ease = put(calving_easenum, 7.);/*changed here to calving_easenum*/

drop calving_easenum;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453645#M114661</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-12T16:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453650#M114662</link>
      <description>&lt;P&gt;calving_ease of the second dataset are all missing by using this code &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453650#M114662</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-04-12T16:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453652#M114663</link>
      <description>&lt;P&gt;Did you notice my edit in the previous message. Anyway, here is a demo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input var $;
datalines;
1
2
3
;

data have1;
input var;
datalines;
1
2
3
;

data want;
set have have1(in=b rename=(var=_var));
if b then var=put(_var,1.);
drop _var;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453652#M114663</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-12T16:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453655#M114665</link>
      <description>&lt;P&gt;Your approach is bang on correct. I think you are having a very minor problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;calving_ease &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;calving_ease&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;7&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I changed the same to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;calving_ease &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;calving_easenum&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;7&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;plus instead of&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; data48 data910&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;rename&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;calving_ease&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;calving_easenum&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I changed this to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; data48 data910&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;b &lt;SPAN class="token function"&gt;rename&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;calving_ease&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;calving_easenum&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453655#M114665</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-12T16:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453658#M114666</link>
      <description>&lt;P&gt;thank you much, I appreciate&amp;nbsp;that, you are done a very good jobe with me, and I'm sorry if I took you time&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks again&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Barkamih&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 16:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453658#M114666</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-04-12T16:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Variable defined as both character and numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453660#M114667</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/151600"&gt;@Barkamih&lt;/a&gt;&amp;nbsp; Hahaha nothing to be apologetic. We all learn and I am sure you share your knowledge too with tohers. Knowledge is meant to be shared and learning good things should a right. Take care and have a nice day!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 17:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-defined-as-both-character-and-numeric/m-p/453660#M114667</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-12T17:01:39Z</dc:date>
    </item>
  </channel>
</rss>

