<?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: SAS Invalid data errors in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Invalid-data-errors/m-p/443379#M110918</link>
    <description>&lt;P&gt;Why do you have a separate input statement for age, month and last in your second data step, when you actually calculate them from other values?&lt;/P&gt;
&lt;P&gt;(this statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;lastname=upcase(last);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;last=upcase(lastname);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;IMO)&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2018 15:57:22 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-03-07T15:57:22Z</dc:date>
    <item>
      <title>SAS Invalid data errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Invalid-data-errors/m-p/443367#M110912</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dm "out;clear;log;clear";
title1 'Homework_5_';
options pageno=1 formchar="|----|+|---+=|-/\&amp;lt;&amp;gt;*";
filename hw5 'C:\users\kan\hw5.txt';
libname sds 'c:\users\kan';
data work.hw5a;
infile hw5 lrecl=100 pad;
input ID $ 1-3 Admission mmddyy6. Discharge mmddyy8. Birth mmddyy8. Lastname $ 27-38;
format Admission mmddyy6. Discharge mmddyy8. Birth mmddyy10.;
proc contents data=work.hw5a;
run;
proc print data=work.hw5a;
run;
data hw5b;
infile hw5 lrecl=100 pad;
retain admit disch dob age month lastname;
input ID $ 3. m 2. d 2. y 2. disch mmddyy8. dob mmddyy8. last $ 27-38;
input age month last;
month=m;
lastname=upcase(last);
admit=mdy(m,d,y);
format admit mmddyy8. disch mmddyy8. dob mmddyy10.;
drop m d y;
age=int((admit-dob)/365);
RETAIN my_id 0;
my_id=sum(my_id,666);
RETAIN Oldest;
Oldest=max(Oldest,age);


proc contents data=hw5b;
run;
proc print data=hw5b;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;I am getting these messages in the log. How can I fix this?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;OTE: Invalid data for age in line 2 1-25.&lt;BR /&gt;NOTE: Invalid data for month in line 2 27-32.&lt;BR /&gt;RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+-&lt;BR /&gt;3 00305129206/09/9212251899 milleR&lt;BR /&gt;87&lt;BR /&gt;NOTE: Invalid data errors for file HW5 occurred outside the printed range.&lt;BR /&gt;NOTE: Increase available buffer lines with the INFILE n= option.&lt;BR /&gt;admit=01/05/92 disch=01/07/92 dob=10/21/1946 age=45 month=1 lastname=00305129206/ ID=001 m=1 d=5&lt;BR /&gt;y=92 last=00305129206/ my_id=666 Oldest=45 _ERROR_=1 _N_=1&lt;BR /&gt;NOTE: LOST CARD.&lt;BR /&gt;admit=01/05/92 disch=01/07/93 dob=04/05/1952 age=45 month=1 lastname=00305129206/ ID=004 m=1 d=1&lt;BR /&gt;y=93 last=Smith-Jones my_id=666 Oldest=45 _ERROR_=1 _N_=2&lt;BR /&gt;NOTE: 6 records were read from the infile HW5.&lt;BR /&gt;The minimum record length was 0.&lt;BR /&gt;The maximum record length was 37.&lt;BR /&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;BR /&gt;NOTE: The data set WORK.HW5B has 1 observations and 10 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.05 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;These are my Data:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;00101059201/07/9210211946 jones&lt;BR /&gt;00211129211/15/9209011955 Taylor&lt;BR /&gt;00305129206/09/9212251899 milleR&lt;BR /&gt;00401019301/07/9304051952 Smith-Jones&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 15:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Invalid-data-errors/m-p/443367#M110912</guid>
      <dc:creator>Nk25</dc:creator>
      <dc:date>2018-03-07T15:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Invalid data errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Invalid-data-errors/m-p/443377#M110916</link>
      <description>&lt;P&gt;Discharge Date -&amp;gt; mmddyy8.&lt;/P&gt;
&lt;P&gt;But it looks like:&amp;nbsp;&lt;SPAN&gt;06/09/92 -&amp;gt; This is 10 characters not 8.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You also have two input statements so SAS thinks it's reading two lines each iteration which doesn't match your data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input ID $ 3. m 2. d 2. y 2. disch mmddyy8. dob mmddyy8. last $ 27-38;
input age month last;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;LI-SPOILER&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197626"&gt;@Nk25&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dm "out;clear;log;clear";
title1 'Homework_5_';
options pageno=1 formchar="|----|+|---+=|-/\&amp;lt;&amp;gt;*";
filename hw5 'C:\users\kan\hw5.txt';
libname sds 'c:\users\kan';
data work.hw5a;
infile hw5 lrecl=100 pad;
input ID $ 1-3 Admission mmddyy6. Discharge mmddyy8. Birth mmddyy8. Lastname $ 27-38;
format Admission mmddyy6. Discharge mmddyy8. Birth mmddyy10.;
proc contents data=work.hw5a;
run;
proc print data=work.hw5a;
run;
data hw5b;
infile hw5 lrecl=100 pad;
retain admit disch dob age month lastname;
input ID $ 3. m 2. d 2. y 2. disch mmddyy8. dob mmddyy8. last $ 27-38;
input age month last;
month=m;
lastname=upcase(last);
admit=mdy(m,d,y);
format admit mmddyy8. disch mmddyy8. dob mmddyy10.;
drop m d y;
age=int((admit-dob)/365);
RETAIN my_id 0;
my_id=sum(my_id,666);
RETAIN Oldest;
Oldest=max(Oldest,age);


proc contents data=hw5b;
run;
proc print data=hw5b;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;I am getting these messages in the log. How can I fix this?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;OTE: Invalid data for age in line 2 1-25.&lt;BR /&gt;NOTE: Invalid data for month in line 2 27-32.&lt;BR /&gt;RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+-&lt;BR /&gt;3 00305129206/09/9212251899 milleR&lt;BR /&gt;87&lt;BR /&gt;NOTE: Invalid data errors for file HW5 occurred outside the printed range.&lt;BR /&gt;NOTE: Increase available buffer lines with the INFILE n= option.&lt;BR /&gt;admit=01/05/92 disch=01/07/92 dob=10/21/1946 age=45 month=1 lastname=00305129206/ ID=001 m=1 d=5&lt;BR /&gt;y=92 last=00305129206/ my_id=666 Oldest=45 _ERROR_=1 _N_=1&lt;BR /&gt;NOTE: LOST CARD.&lt;BR /&gt;admit=01/05/92 disch=01/07/93 dob=04/05/1952 age=45 month=1 lastname=00305129206/ ID=004 m=1 d=1&lt;BR /&gt;y=93 last=Smith-Jones my_id=666 Oldest=45 _ERROR_=1 _N_=2&lt;BR /&gt;NOTE: 6 records were read from the infile HW5.&lt;BR /&gt;The minimum record length was 0.&lt;BR /&gt;The maximum record length was 37.&lt;BR /&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;BR /&gt;NOTE: The data set WORK.HW5B has 1 observations and 10 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.05 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;These are my Data:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;00101059201/07/9210211946 jones&lt;BR /&gt;00211129211/15/9209011955 Taylor&lt;BR /&gt;00305129206/09/9212251899 milleR&lt;BR /&gt;00401019301/07/9304051952 Smith-Jones&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 15:56:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Invalid-data-errors/m-p/443377#M110916</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-07T15:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Invalid data errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Invalid-data-errors/m-p/443379#M110918</link>
      <description>&lt;P&gt;Why do you have a separate input statement for age, month and last in your second data step, when you actually calculate them from other values?&lt;/P&gt;
&lt;P&gt;(this statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;lastname=upcase(last);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;last=upcase(lastname);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;IMO)&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 15:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Invalid-data-errors/m-p/443379#M110918</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-07T15:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Invalid data errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Invalid-data-errors/m-p/445215#M111535</link>
      <description>It worked!&lt;BR /&gt;Thanks!</description>
      <pubDate>Tue, 13 Mar 2018 16:01:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Invalid-data-errors/m-p/445215#M111535</guid>
      <dc:creator>Nk25</dc:creator>
      <dc:date>2018-03-13T16:01:20Z</dc:date>
    </item>
  </channel>
</rss>

