<?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 Merge both character and numeric variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473083#M121351</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;CODE:&lt;BR /&gt;data trial; /*name of the new dataset*/
    attrib new length=$4; /*name of the variable to which calculated value is 
                                       assigned*/
    set database; /*original dataset*/
by SUBJECT; /*sorting by SUBJECT, which is UNIQUE and with no 
                      duplicates*/
/*Calculating the new variable by using the following condition*/
if (upcase (AUNIT) eq 'U/L' AND upcase (AVALUE) &amp;gt; 2000) or
   (upcase (BVALUE) eq 'BILIRUBIN LEVEL' AND upcase (ASUNIT) eq 'MG/DL' AND upcase (AVALUE) &amp;gt; '10') or 
    (upcase (GRAFT) eq 'Yes') 
     then new="Yes";
     else new="No";
run; 

Proc sort data=trial;
      by SUBJECT;
run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;DIV class="sasNote"&gt;Hi,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;BR /&gt;IF Condition with few numeric and character types are to be considered, and out put to be displayed should be a character Value (YES or NO) which is resulting in the following NOTE.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;70:37&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;70:147 71:83 72:78 72:147&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;What could be possible solution?&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;1. Convert the numeric values to character values?&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;2. Doing #1, is leading to another NOTE which says that the variable is both in character and numeric.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Any suggestions?&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Thank you,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;BR /&gt;Regards,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Nasya&lt;/DIV&gt;</description>
    <pubDate>Mon, 25 Jun 2018 17:56:27 GMT</pubDate>
    <dc:creator>Nasya</dc:creator>
    <dc:date>2018-06-25T17:56:27Z</dc:date>
    <item>
      <title>Merge both character and numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473083#M121351</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;CODE:&lt;BR /&gt;data trial; /*name of the new dataset*/
    attrib new length=$4; /*name of the variable to which calculated value is 
                                       assigned*/
    set database; /*original dataset*/
by SUBJECT; /*sorting by SUBJECT, which is UNIQUE and with no 
                      duplicates*/
/*Calculating the new variable by using the following condition*/
if (upcase (AUNIT) eq 'U/L' AND upcase (AVALUE) &amp;gt; 2000) or
   (upcase (BVALUE) eq 'BILIRUBIN LEVEL' AND upcase (ASUNIT) eq 'MG/DL' AND upcase (AVALUE) &amp;gt; '10') or 
    (upcase (GRAFT) eq 'Yes') 
     then new="Yes";
     else new="No";
run; 

Proc sort data=trial;
      by SUBJECT;
run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;DIV class="sasNote"&gt;Hi,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;BR /&gt;IF Condition with few numeric and character types are to be considered, and out put to be displayed should be a character Value (YES or NO) which is resulting in the following NOTE.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;70:37&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;70:147 71:83 72:78 72:147&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;What could be possible solution?&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;1. Convert the numeric values to character values?&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;2. Doing #1, is leading to another NOTE which says that the variable is both in character and numeric.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Any suggestions?&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Thank you,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&lt;BR /&gt;Regards,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Nasya&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Jun 2018 17:56:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473083#M121351</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-06-25T17:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Merge both character and numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473108#M121364</link>
      <description>&lt;P&gt;to make the note go away, treat the char variable as char and the numeric variable as numeric. You just need to double check what your variables are and then treat them accordingly. There is certainly an issue with this bit "upcase (AVALUE) &amp;gt; 2000", because you are saying avalue is char but treating it as numeric. First convert it to numeric, as you say&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 18:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473108#M121364</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2018-06-25T18:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Merge both character and numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473110#M121366</link>
      <description>Thanks for your response. AVALUE is in numeric only, no conversion is made. Other values are Character in type. The new variable is a character too- displaying output as Yes or No.&lt;BR /&gt;Combining Numeric and Character values and displaying output as Character is possible or do we have to convert all the variables to Character?</description>
      <pubDate>Mon, 25 Jun 2018 18:49:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473110#M121366</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-06-25T18:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Merge both character and numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473129#M121374</link>
      <description>&lt;P&gt;if avalue is numeric why do you have: upcase (AVALUE) &amp;gt; '10'. Note that this is inconsistent with this other piece of code where there are no quote marks: upcase (AVALUE) &amp;gt; 2000. First remove the use of "upcase", if it's numeric you shouldn't be using this. And remove the quote marks in the first bit of code.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 19:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473129#M121374</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2018-06-25T19:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Merge both character and numeric variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473138#M121376</link>
      <description>Worked. Thanks a lot.&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Jun 2018 19:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-both-character-and-numeric-variables/m-p/473138#M121376</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-06-25T19:34:38Z</dc:date>
    </item>
  </channel>
</rss>

