<?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: Invalid numeric data error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/367618#M87561</link>
    <description>&lt;P&gt;You are trying to assign a character value to a numeric variable, that is why you get an error. Write the value 'Male' to a vairble suct as genderc and yo will be fine&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data amt2.value_labels;
set amt2.assignment2;
if gender = 0 then genderc = 'Male';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 16 Jun 2017 07:13:38 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2017-06-16T07:13:38Z</dc:date>
    <item>
      <title>Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/367616#M87560</link>
      <description>&lt;P&gt;This is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data amt2.value_labels;&lt;BR /&gt;set amt2.assignment2;&lt;BR /&gt;if gender = 0 then gender = 'Male';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This converted all the values with zero to .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error Message:&lt;/P&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;64:29&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Invalid numeric data, 'Male' , at line 64 column 29.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;storeid=1 hlthfood=0 size=2 org=2 custid=1 gender=. shopfor=1 veg=0 style=1 usecoup=3 week=1 seq=4 carry=0 coupval=4 amtspent=215.28&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Any Solutions?.&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Jun 2017 07:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/367616#M87560</guid>
      <dc:creator>Sakthivel_Saran</dc:creator>
      <dc:date>2017-06-16T07:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/367618#M87561</link>
      <description>&lt;P&gt;You are trying to assign a character value to a numeric variable, that is why you get an error. Write the value 'Male' to a vairble suct as genderc and yo will be fine&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data amt2.value_labels;
set amt2.assignment2;
if gender = 0 then genderc = 'Male';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jun 2017 07:13:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/367618#M87561</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-06-16T07:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/367812#M87623</link>
      <description>&lt;P&gt;Or skip the new variable entirely.&lt;/P&gt;
&lt;P&gt;I am guessing that a value of 1 may be female. If different change the vale in proc format code from 1 to the appropriate value.&lt;/P&gt;
&lt;P&gt;If you have more values for gender then add additional code values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
value mygender
0= 'Male'
1= 'Female'
;

proc print data=amt2.assignment2;
   var gender;
   format gender mygender.;
run;&lt;/PRE&gt;
&lt;P&gt;Custom formats can be used to display different text for&amp;nbsp;the same variable in different places. For instance you may have a need for a display of single letter for gender, so you make a different named format (the first word after VALUE above) and only have M and F as values, or you want to display something like "** Male **", a different format and use. Groups of codes can also be assigned to single&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;display value that will be honored by most procedures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Especially with large data sets creating a new format may be much more time efficient than duplicating a data set just to get a different display.&lt;/P&gt;
&lt;P&gt;And you can use formats for character variables in a similar way.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 17:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-error/m-p/367812#M87623</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-16T17:22:08Z</dc:date>
    </item>
  </channel>
</rss>

