<?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: change character value to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525887#M143112</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/230936"&gt;@Songchan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, the first picture is the contents before converting format, the second is the log of changing format&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 434px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26151iA4B2D6E47C0EF449/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26152i79DE9058068CB3EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Check the line of the code indicated in the log - Line 163 in your log will tell you exactly where in your code is the issue. Is that your conversion line? It helps if you show the full log. As others have indicated you cannot change in place, you need to rename the variable ... we could tell you what's wrong if you show the code.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Jan 2019 21:08:53 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-01-09T21:08:53Z</dc:date>
    <item>
      <title>change character value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525843#M143098</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my data, "permno" is character value, i tried to convert it into numeric value, but it didn't work.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp02; set temp01;
     if permno=. then delete; 
	 format startdate enddate yymmddn8.;
	 keep permno StartDate enddate ticker;
run;

data temp02; set temp02;
     permno= input(permno, 8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Jan 2019 20:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525843#M143098</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-09T20:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: change character value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525847#M143099</link>
      <description>&lt;P&gt;Could you elaborate on what you meant by didn't work ? post the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this statement you are treating permno as if it is numeric&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if permno=. then delete; &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;but in the next step you are trying to convert permno to numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;permno= input(permno, 8.);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 20:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525847#M143099</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2019-01-09T20:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: change character value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525849#M143101</link>
      <description>&lt;P&gt;It can't be done.&amp;nbsp; Once a variable is character, it remains character forever.&amp;nbsp; You can program around that.&amp;nbsp; But first, to refer to missing values for a character variable, use a blank within quotes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp02;
   set temp01;
   if permno = ' ' then delete;
   format startdate enddate yymmddn8.;
   keep permno StartDate enddate ticker;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your original syntax would be correct for a missing value for a numeric variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get a numeric variable from the character PERMNO, you need to create a new variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp03;
   set temp02
   permno_c = input(permno, 8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to re-use the same variable name (PERMNO), you can add to the same DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp03;
   set temp02;
   permno_c = input(permno, 8.);
   drop permno;
   rename permno_c = permno;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That's what it takes to come up with PERMNO as a numeric variable.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 20:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525849#M143101</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-01-09T20:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: change character value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525851#M143103</link>
      <description>&lt;P&gt;You have to create a new variable when converting.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp02; set temp02;
     permno_num= input(permno, 8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Jan 2019 20:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525851#M143103</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-01-09T20:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: change character value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525860#M143104</link>
      <description>&lt;P&gt;Hi, the first picture is the contents before converting format, the second is the log of changing format&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 434px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26151iA4B2D6E47C0EF449/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26152i79DE9058068CB3EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 20:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525860#M143104</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-09T20:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: change character value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525887#M143112</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/230936"&gt;@Songchan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, the first picture is the contents before converting format, the second is the log of changing format&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 434px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26151iA4B2D6E47C0EF449/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26152i79DE9058068CB3EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Check the line of the code indicated in the log - Line 163 in your log will tell you exactly where in your code is the issue. Is that your conversion line? It helps if you show the full log. As others have indicated you cannot change in place, you need to rename the variable ... we could tell you what's wrong if you show the code.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 21:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525887#M143112</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-09T21:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: change character value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525907#M143115</link>
      <description>&lt;P&gt;Thank you, that works!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 22:00:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525907#M143115</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-09T22:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: change character value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525908#M143116</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 22:01:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/change-character-value-to-numeric/m-p/525908#M143116</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2019-01-09T22:01:01Z</dc:date>
    </item>
  </channel>
</rss>

