BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
karthikraop
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

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]

View solution in original post

9 REPLIES 9
karthikraop
Fluorite | Level 6
No. there is blank space after Mar-13
ChrisNZ
Tourmaline | Level 20

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]

Kurt_Bremser
Super User

@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.

 

karthikraop
Fluorite | Level 6
Hello Kurt,

thank you very much for your response. your suggestion worked for me.

Thanks,
Karthik.
ballardw
Super User

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
Fluorite | Level 6
Hello Ballard,

thanks for the hint on effective use of forum.

Thanks,
Karthik.
Reeza
Super User

@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;
karthikraop
Fluorite | Level 6
Hello Reeza,

thank you for your response. I have added Missover next to dlm='09'x in my code then it worked for me.

thanks,
Karthik.

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 1328 views
  • 0 likes
  • 5 in conversation