Hello,
When I run the following code in SAS, it is giving me no errors but when I run the same code using windows task scheduler I am getting errors.
data pdata;
input Month$ Num Den;
datalines;
Jan-13 11 37
Feb-13 21 39
Mar-13 15 32
Apr-13 24 43
May-13 21 31
Jun-13 19 35
Jul-13 17 43
Aug-13 15 34
Sep-13 11 28
Oct-13 16 29
Nov-13 16 30
Dec-13 15 30
;
run;
Here is the error message I am getting when using task scheduler.
data pdata;
3 input Month$ Num Den;
4 datalines;
NOTE: Invalid data for Num in line 6 1-12.
NOTE: Invalid data for Den in line 7 1-12.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----
7 CHAR Mar-13.15.32
ZONE 46723303303322222222222222222222222222222222222222222222222222222222222222222222
NUMR D12D1391593200000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Month=Jan-13 1 Num=. Den=. _ERROR_=1 _N_=1
NOTE: Invalid data for Num in line 9 1-12.
Please help me out.
thanks,
Karthik.
No there isn't a space there.
You have to look at the log more carefully.
It shows you have a tab (hexadecimal code 09).
Clean your data.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----
CHAR Mar-13.15.32
ZONE 46723303303322222222222222222222222222222222222222222222222222222222222222222222
NUMR D12D1391593200000000000000000000000000000000000000000000000000000000000000000000
[Edited: formatting]
Why is there a dot after Mar-13 ?
No there isn't a space there.
You have to look at the log more carefully.
It shows you have a tab (hexadecimal code 09).
Clean your data.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----
CHAR Mar-13.15.32
ZONE 46723303303322222222222222222222222222222222222222222222222222222222222222222222
NUMR D12D1391593200000000000000000000000000000000000000000000000000000000000000000000
[Edited: formatting]
@karthikraop wrote:
No. there is blank space after Mar-13
Read your log again:
data pdata; 3 input Month$ Num Den; 4 datalines; NOTE: Invalid data for Num in line 6 1-12. NOTE: Invalid data for Den in line 7 1-12. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8---- 7 CHAR Mar-13.15.32 ZONE 46723303303322222222222222222222222222222222222222222222222222222222222222222222 NUMR D12D1391593200000000000000000000000000000000000000000000000000000000000000000000 NOTE: Invalid data errors for file CARDS occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Month=Jan-13 1 Num=. Den=. _ERROR_=1 _N_=1 NOTE: Invalid data for Num in line 9 1-12.
The dots in the log are used to represent non-displayable characters, in this case tabs. Tabs can be used as delimiters, but then you should use an infile statement with the proper delimiter:
infile datalines dlm='09'x;
Tabs are displayed as one or more blanks in the program editor; it is always a good idea (IMO) to set the Enhanced Editor to not use tabs, and expand all tabs on input to the proper number of blanks. The resulting code in files is then safe across different execution environments.
A hint on reading your log. the following line in your errors:
Month=Jan-13 1 Num=. Den=. _ERROR_=1 _N_=1
Shows the value of Month as read to be "Jan-13 1". Note that means that your code read the first part of Num into the Month variable. So that tells you have at least one issue with the way your input is working. Since the remaining 1 of 11 was NOT read into the variable Num that indicates the character following the second 1 was not interpreted as value separator, i.e. blank, and continue reading the data looking for a blank to end the current value. The error occurs because "1 37" is not a valid numeric value.
These
NOTE: Invalid data for Num in line 6 1-12. NOTE: Invalid data for Den in line 7 1-12.
tell that Num and Den were attempting to be read from column 1 through 12 (your entire line) AND on different lines.
Second, a hint on using the forum more effectively: Post code and log text into a code box opened with the forums {I} icon, or the "running man" icon. The main message windows will reformat text, which you may see if you use code indentation, and the font by default is proportional. So text such as error message indicators which often place underscores under the line of code will not appear correctly unless in a code box.
@karthikraop wrote:
Hello,
When I run the following code in SAS, it is giving me no errors but when I run the same code using windows task scheduler I am getting errors.
data pdata;
input Month$ Num Den;
datalines;
Jan-13 11 37
Feb-13 21 39
Mar-13 15 32
Apr-13 24 43
May-13 21 31
Jun-13 19 35
Jul-13 17 43
Aug-13 15 34
Sep-13 11 28
Oct-13 16 29
Nov-13 16 30
Dec-13 15 30
;
run;
Here is the error message I am getting when using task scheduler.
data pdata;
3 input Month$ Num Den;
4 datalines;NOTE: Invalid data for Num in line 6 1-12.
NOTE: Invalid data for Den in line 7 1-12.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----7 CHAR Mar-13.15.32
ZONE 46723303303322222222222222222222222222222222222222222222222222222222222222222222
NUMR D12D1391593200000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Month=Jan-13 1 Num=. Den=. _ERROR_=1 _N_=1
NOTE: Invalid data for Num in line 9 1-12.
Please help me out.
thanks,
Karthik.
Specify tabs as your delimiter.
data pdata;
infile cards dlm='09'x;
input Month$ Num Den;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.