<?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 NOTE:  Character values have been converted to numeric values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407387#M279412</link>
    <description>&lt;P&gt;LOG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;108&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;109 Data MCAssign2;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;110 Set MCCAssign1 (keep=&amp;nbsp;ID ctAlteration Alteration protocol);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;111 IDchar = put(ID, $24.);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;112 drop ID;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;113 rename IDchar=ID;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;114 Run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 30871 observations read from the data set WORK.MCCASSIGN1.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.MCASSIGN2 has 30871 observations and 4 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;115&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;116&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;117 Data Final (drop=a ct);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;118 do until (last.ID);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;119 set MCCAssign1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;120 By MRN;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;121 if not missing (alteration) then a='1';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;122 if not missing(ctalteration) then ct='1';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;123 end;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;124 do until (last.ID);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;125 set MCCAssign1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;126 by ID;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;127 if a and ct then output;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;128 end;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;129 Run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&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;127:4 127:10&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 30871 observations read from the data set WORK.MCCASSIGN1.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 30871 observations read from the data set WORK.MCCASSIGN1.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.FINAL has 5767 observations and 4 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;130&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;131 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;144&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Hi, so I've been having issues with my character values being converted to numeric. This causes my "Final" dataset to only have 5767 observations, down from&amp;nbsp; 30,871 observations, which is a lot of observations I am losing. I have tried converting ID to a character variable, but I don't think it ended up working. Any help is much appreciated.&lt;/DIV&gt;</description>
    <pubDate>Wed, 25 Oct 2017 17:43:26 GMT</pubDate>
    <dc:creator>kmardinian</dc:creator>
    <dc:date>2017-10-25T17:43:26Z</dc:date>
    <item>
      <title>NOTE:  Character values have been converted to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407387#M279412</link>
      <description>&lt;P&gt;LOG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;108&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;109 Data MCAssign2;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;110 Set MCCAssign1 (keep=&amp;nbsp;ID ctAlteration Alteration protocol);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;111 IDchar = put(ID, $24.);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;112 drop ID;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;113 rename IDchar=ID;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;114 Run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 30871 observations read from the data set WORK.MCCASSIGN1.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.MCASSIGN2 has 30871 observations and 4 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;115&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;116&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;117 Data Final (drop=a ct);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;118 do until (last.ID);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;119 set MCCAssign1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;120 By MRN;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;121 if not missing (alteration) then a='1';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;122 if not missing(ctalteration) then ct='1';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;123 end;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;124 do until (last.ID);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;125 set MCCAssign1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;126 by ID;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;127 if a and ct then output;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;128 end;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;129 Run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&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;127:4 127:10&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 30871 observations read from the data set WORK.MCCASSIGN1.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 30871 observations read from the data set WORK.MCCASSIGN1.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.FINAL has 5767 observations and 4 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;130&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;131 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;144&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Hi, so I've been having issues with my character values being converted to numeric. This causes my "Final" dataset to only have 5767 observations, down from&amp;nbsp; 30,871 observations, which is a lot of observations I am losing. I have tried converting ID to a character variable, but I don't think it ended up working. Any help is much appreciated.&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Oct 2017 17:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407387#M279412</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2017-10-25T17:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE:  Character values have been converted to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407390#M279413</link>
      <description>&lt;P&gt;Variables used as boolean have to be numeric. 0 = false, non-zero values = true. So assign 0 or 1 instead of '0' and '1'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;About your exclusion problem: find observations that should be included but aren't, and run them through your code "manually" (pencil&amp;amp;paper).&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 17:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407390#M279413</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-25T17:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE:  Character values have been converted to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407438#M279414</link>
      <description>&lt;P&gt;You have a critical typo in the program.&amp;nbsp; Your top loop :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do until (last.ID);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But inside the loop, the BY statement reads:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BY MRN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Those are not consistent, and illogical.&amp;nbsp; The only reason you get no error message is because of the bottom DO loop, which actually does create last.ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, note that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;is correct.&amp;nbsp; If you don't want variables convered to numeric, a good solution is often to create them as numeric yourself:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if ...... then a=1;&lt;/P&gt;
&lt;P&gt;if ....... then ct=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you put quotes around the "1" you are creating them as character, which later forces SAS to convert them back to numeric.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 19:25:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407438#M279414</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-10-25T19:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE:  Character values have been converted to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407445#M279415</link>
      <description>&lt;P&gt;Yes, definitely fixed that typo and removed the quotations and that part of the code is working. I'm currently going through the data manually to see which values are not being read. This way I can try and figure out why I'm losing so many observations&lt;/P&gt;&lt;P&gt;Thank you for all the help!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 19:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407445#M279415</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2017-10-25T19:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE:  Character values have been converted to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407459#M279416</link>
      <description>&lt;P&gt;A useful bit of SAS coding knowledge:&lt;/P&gt;
&lt;P&gt;Instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if not missing (alteration) then a='1';&lt;/P&gt;
&lt;P&gt;you can use&lt;/P&gt;
&lt;P&gt;a = not missing (alteration);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's easy to create Boolean values:&lt;/P&gt;
&lt;PRE&gt;data junk;
   input x;
   a= not missing(x);
   b = x ge 3;
datalines;
1
.
3
44
;
run;&lt;/PRE&gt;
&lt;P&gt;Just be sure that if only want a value when a certain condition occurs that you have and IF / then assignment otherwise every record has either 0 or 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 20:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-Character-values-have-been-converted-to-numeric-values/m-p/407459#M279416</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-10-25T20:24:17Z</dc:date>
    </item>
  </channel>
</rss>

