<?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: Question about input statement and resultant log errors in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947791#M42568</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I'd go back and look at your code more carefully. If your data is as you describe, then you should not have the INPUT function NOTE that you received. Are you sure your weights are standard numbers? I don't observe the same behavior with a test data table that has a character value for WEIGHTOLD and gets converted to a numeric variable WEIGHTNEW:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1729127483196.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/101350iF80E8B00E64CDEA1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1729127483196.png" alt="Cynthia_sas_0-1729127483196.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; But you can force the INPUT note if your character string is not composed of standard numeric values. In the example below, the period is the thousands separator and the comma is the decimal separator, so I can see the NOTE in the log with a simple INFORMAT and I get rid of the NOTE using the COMMAX informat.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_1-1729128119850.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/101351i664E8B61B1E836B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_1-1729128119850.png" alt="Cynthia_sas_1-1729128119850.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2024 01:22:10 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2024-10-17T01:22:10Z</dc:date>
    <item>
      <title>Question about input statement and resultant log errors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947775#M42567</link>
      <description>&lt;P&gt;I have character variables that have numeric values, such as height and weight. To recode these as numeric, I made a new variable using the 'input' such as below.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;weightnew = input(weightold, 8.);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Functionally this works, but it also produces an error wherever there is a missing value for weightold.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;NOTE: Invalid argument to function INPUT at line 10516 column 10.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be printed.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This ultimately doesn't appear to matter as each of those missing character values becomes recoded as a missing numeric value, but the sight of all those errors in the log makes me worry something is wrong.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a better way to change weightold (character) to weightnew (numeric) than using the input statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Secondly, should I be bothered by the error log looking the way it does, or if it is doing what I want should I just ignore?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;CODE class=""&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 21:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947775#M42567</guid>
      <dc:creator>sasgorilla</dc:creator>
      <dc:date>2024-10-16T21:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Question about input statement and resultant log errors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947791#M42568</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I'd go back and look at your code more carefully. If your data is as you describe, then you should not have the INPUT function NOTE that you received. Are you sure your weights are standard numbers? I don't observe the same behavior with a test data table that has a character value for WEIGHTOLD and gets converted to a numeric variable WEIGHTNEW:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1729127483196.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/101350iF80E8B00E64CDEA1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1729127483196.png" alt="Cynthia_sas_0-1729127483196.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; But you can force the INPUT note if your character string is not composed of standard numeric values. In the example below, the period is the thousands separator and the comma is the decimal separator, so I can see the NOTE in the log with a simple INFORMAT and I get rid of the NOTE using the COMMAX informat.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_1-1729128119850.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/101351i664E8B61B1E836B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_1-1729128119850.png" alt="Cynthia_sas_1-1729128119850.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 01:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947791#M42568</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2024-10-17T01:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Question about input statement and resultant log errors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947796#M42569</link>
      <description>&lt;P&gt;When there are known issues and you just want the log not to show invalid data you can use a modifier in the Input function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   input weightold $;
   weightnew = input(weightold, ?? 8.);
datalines;
1.23
33lb
45.8
abc
;&lt;/PRE&gt;
&lt;P&gt;Note the two question marks. They modify the Input to not display invalid data.&lt;/P&gt;
&lt;P&gt;I would suggest &lt;STRONG&gt;not&lt;/STRONG&gt; using this option unless you very sure of the reasons why you have values that can't be made numeric such as text like N/A entered in a source.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 02:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947796#M42569</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-10-17T02:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Question about input statement and resultant log errors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947802#M42570</link>
      <description>&lt;P&gt;If you've got known strings like n/a that you want to convert to missings but also want to stay on the safe side and not just suppress any errors or warnings with the ?? modifier then you could also create your own informat using code similar to below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue char2num
    'n/a' = .
    other = [best32.]
    ;
run;

data demo_1;
  infile datalines truncover;
  input charvar $;
  numvar_1=input(charvar,char2num32.);
  datalines;
11
2
n/a
4
;

data demo_2;
  infile datalines truncover;
  input charvar $;
  numvar_1=input(charvar,char2num32.);
  datalines;
11
2
n/a
4
xxx
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Oct 2024 03:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947802#M42570</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-10-17T03:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Question about input statement and resultant log errors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947815#M42571</link>
      <description>&lt;P&gt;Maxim 3: Know Your Data.&lt;/P&gt;
&lt;P&gt;Your log should also have a listing of variable values when an "invalid" NOTE is issued.&lt;/P&gt;
&lt;P&gt;Your variable weightold contains character data which cannot be converted by using the 8. informat.&lt;/P&gt;
&lt;P&gt;Please show us those values.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 06:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947815#M42571</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-10-17T06:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Question about input statement and resultant log errors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947816#M42572</link>
      <description>&lt;P&gt;BTW your subject line is not correct. Your issue is not with the INPUT&amp;nbsp;&lt;EM&gt;statement&lt;/EM&gt;, but with the INPUT()&amp;nbsp;&lt;EM&gt;function&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 10:28:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947816#M42572</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-10-17T10:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Question about input statement and resultant log errors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947821#M42573</link>
      <description>&lt;P&gt;Here's a way to explore the data, to see which values are causing a problem:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
   tables weight;
   where input(weight, ??8.) = .;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It might be that all the trouble-makers are "." or there might be a more troublesome situation such as substituting "O" for "0" some of the time.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 08:10:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947821#M42573</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-10-17T08:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Question about input statement and resultant log errors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947838#M42576</link>
      <description>&lt;P&gt;Thankyou for your help, everyone!&amp;nbsp;I accepted this as the solution since it helped me catch and clean few values that were contributing to the errors.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One correction: your provided code would not run unless I eliminated one of the '?'. The code below is what worked for me.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
   tables weight;
   where input(weight, ?8.) = .;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Oct 2024 10:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947838#M42576</guid>
      <dc:creator>sasgorilla</dc:creator>
      <dc:date>2024-10-17T10:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Question about input statement and resultant log errors</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947848#M42577</link>
      <description>&lt;P&gt;Yes. The WHERE statement is processed like an SQL statement.&amp;nbsp; And in that setting the functionality implied by the ?? modifier does not exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also are you positive the character variable has a maximum length of only 8?&amp;nbsp; If not then you use of a width of 8 on the informat will ignore the end of the string.&amp;nbsp; Unless there is some reason you want it to ignore the ends of the string use the maximum width that the informat supports, which is 32.&amp;nbsp; The INPUT() function does not care if the width of the informat specification is larger than the length of the string being read.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 12:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-input-statement-and-resultant-log-errors/m-p/947848#M42577</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-17T12:42:55Z</dc:date>
    </item>
  </channel>
</rss>

