<?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 Numeric values have been converted to character values at the places in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898663#M355214</link>
    <description>&lt;P&gt;When I use two numeric variables to create a third variable, I get a warning in the log saying that&amp;nbsp;&amp;nbsp;&lt;FONT color="#3366FF"&gt;"Numeric values have been converted to character values at the places given by: (Line):(Column).&amp;nbsp;4106:28 4107:10"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;I have used the code below:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;if travel_time&amp;lt;=30 then acs=1; /*accessible*/&lt;BR /&gt;else acs=0; /*not accessible*/;&lt;BR /&gt;&lt;BR /&gt;When I check my proc contents for "acs" variable created above, it shows that the type is Char (len=29), while travel_time is of numeric type (len=8). Can you guy suggest any solution to this? Why am I having this error? Shouldn't I have numeric value for acs when travel_time is all numeric?&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Oct 2023 15:45:25 GMT</pubDate>
    <dc:creator>amanshrestha</dc:creator>
    <dc:date>2023-10-15T15:45:25Z</dc:date>
    <item>
      <title>Numeric values have been converted to character values at the places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898663#M355214</link>
      <description>&lt;P&gt;When I use two numeric variables to create a third variable, I get a warning in the log saying that&amp;nbsp;&amp;nbsp;&lt;FONT color="#3366FF"&gt;"Numeric values have been converted to character values at the places given by: (Line):(Column).&amp;nbsp;4106:28 4107:10"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;I have used the code below:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;if travel_time&amp;lt;=30 then acs=1; /*accessible*/&lt;BR /&gt;else acs=0; /*not accessible*/;&lt;BR /&gt;&lt;BR /&gt;When I check my proc contents for "acs" variable created above, it shows that the type is Char (len=29), while travel_time is of numeric type (len=8). Can you guy suggest any solution to this? Why am I having this error? Shouldn't I have numeric value for acs when travel_time is all numeric?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2023 15:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898663#M355214</guid>
      <dc:creator>amanshrestha</dc:creator>
      <dc:date>2023-10-15T15:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric values have been converted to character values at the places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898665#M355215</link>
      <description>&lt;P&gt;Are you able to show your actual code?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You say you use two numeric variables to create the third, but you're only showing one? I'm just a little confused. Maybe I'm missing something.&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2023 16:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898665#M355215</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2023-10-15T16:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric values have been converted to character values at the places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898666#M355216</link>
      <description>&lt;P&gt;My bad, it was just one variable travel_time&lt;BR /&gt;&lt;BR /&gt;if travel_time&amp;lt;=30 then acs=1; /*accessible*/&lt;BR /&gt;else acs=0; /*not accessible*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;travel_time is a numeric variable with values ranging from 9 to 104. But, when I dichotomize it into an acs variable, the acs variable becomes the character. Should not acs be numeric?&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2023 16:33:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898666#M355216</guid>
      <dc:creator>amanshrestha</dc:creator>
      <dc:date>2023-10-15T16:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric values have been converted to character values at the places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898670#M355218</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/444222"&gt;@amanshrestha&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;My bad, it was just one variable travel_time&lt;BR /&gt;&lt;BR /&gt;if travel_time&amp;lt;=30 then acs=1; /*accessible*/&lt;BR /&gt;else acs=0; /*not accessible*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;travel_time is a numeric variable with values ranging from 9 to 104. But, when I dichotomize it into an acs variable, the acs variable becomes the character. Should not acs be numeric?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to show the whole code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example I assume those two statements are part of some data step like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  if travel_time&amp;lt;=30 then acs=1; 
  else acs=0; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If there is already a variable named ACS in the source dataset then ACS will defined by the SET statement.&amp;nbsp; So when you try to assign a numeric values like 0 or 1 to it then SAS will convert the number to a character string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a demonstration run this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  do travel_time=10,30,50 ;
    output;
  end;
  length acs $29;
run;

data want;
  set have;
  if travel_time&amp;lt;=30 then acs=1; 
  else acs=0; 
  put travel_time= acs=:$quote.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will see this in the LOG&lt;/P&gt;
&lt;PRE&gt;479  data want;
480    set have;
481    if travel_time&amp;lt;=30 then acs=1;
482    else acs=0;
483    put travel_time= acs=:$quote.;
484  run;

NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
      481:31   482:12
travel_time=10 acs="                            1"
travel_time=30 acs="                            1"
travel_time=50 acs="                            0"
NOTE: There were 3 observations read from the data set WORK.HAVE.
NOTE: The data set WORK.WANT has 3 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.03 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2023 16:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898670#M355218</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-10-15T16:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric values have been converted to character values at the places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898700#M355227</link>
      <description>&lt;P&gt;If acs is a char variable, why don't you assign quoted values to it?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if travel_time &amp;lt;= 30 then acs = "1"; /*accessible*/
else acs = "0";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Oct 2023 05:54:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898700#M355227</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-10-16T05:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric values have been converted to character values at the places</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898802#M355254</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/444222"&gt;@amanshrestha&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Your question is&amp;nbsp; "&lt;SPAN&gt;Shouldn't I have numeric value for acs when travel_time is all numeric?"&lt;BR /&gt;I should be numeric as I see it. My code is given below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  travel_time = 29;
  if travel_time&amp;lt;=30 then acs=1; 
  else acs=0; 
run;
proc contents data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I see this from proc contents:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1697466447715.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88891iC31C88CA9DF74B89/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_0-1697466447715.png" alt="Sajid01_0-1697466447715.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is possible that you might have defined acs as character variable. In that event you will be receiving the Note you are seeing.&lt;BR /&gt;In that event, avoid the Note,&amp;nbsp; &amp;nbsp;use acs="1" and acs ="0" i.e. enclose values in quotes (double or single)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 14:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-values-have-been-converted-to-character-values-at-the/m-p/898802#M355254</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2023-10-16T14:42:23Z</dc:date>
    </item>
  </channel>
</rss>

