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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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