BookmarkSubscribeRSS Feed
NewSASUser17
Calcite | Level 5

Hello All,

 

I am trying to write a data set with 2 variables and each variable has 30 observations, but the SAS code won't run. Here is a snip of what I am doing

 

data Payroll;
Input Payroll Win;
datalines;
206 95
162 89
146 75
142 97
134 79
123 81
106 88
105 80
99 92
98 94
95 80
92 76
86 61
86 86
84 91
84 83
82 66
81 77
72 96
71 91
71 67
62 85
61 65
61 69
61 69
57 80
55 90
52 81
38 90
35 57
;
proc print;
run;

 

In the Log section, it doesn't give me errors but spits out 65 notes! And it gives me blanks with 15 rows for 15 observations..pic attached. Please help!

 

Thanks!

 

 

 

 

SAS.PNG

 

8 REPLIES 8
ChrisBrooks
Ammonite | Level 13

The code that you've posted runs fine for me - see below

 

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         data Payroll;
 63         Input Payroll Win;
 64         datalines;
 
 NOTE: The data set WORK.PAYROLL has 30 observations and 2 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 95         ;
 
 96         proc print;
 97         run;
 
 NOTE: There were 30 observations read from the data set WORK.PAYROLL.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.07 seconds
       cpu time            0.03 seconds

It's possible that the option "obs=0" has been set by an error in some other piece of the code - can you post either the full code or the notes you are getting in your log.

NewSASUser17
Calcite | Level 5

Thank you so much for the reply you all! What I pasted was the full code and below are the Notes from the Log section:

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
61
62 data Payroll;
63 Input Payroll Win;
64 datalines;
 
NOTE: Invalid data for Payroll in line 65 1-6.
NOTE: Invalid data for Win in line 66 1-6.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
 
66 CHAR 162.89
ZONE 33303322222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 16298900000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=1
NOTE: Invalid data for Payroll in line 67 1-6.
NOTE: Invalid data for Win in line 68 1-6.
 
68 CHAR 142.97
ZONE 33303322222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 14299700000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=2
NOTE: Invalid data for Payroll in line 69 1-6.
NOTE: Invalid data for Win in line 70 1-6.
 
70 CHAR 123.81
ZONE 33303322222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 12398100000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=3
NOTE: Invalid data for Payroll in line 71 1-6.
NOTE: Invalid data for Win in line 72 1-6.
 
72 CHAR 105.80
ZONE 33303322222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 10598000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=4
NOTE: Invalid data for Payroll in line 73 1-5.
NOTE: Invalid data for Win in line 74 1-5.
 
74 CHAR 98.94
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 98994000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=5
NOTE: Invalid data for Payroll in line 75 1-5.
NOTE: Invalid data for Win in line 76 1-5.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
 
76 CHAR 92.76
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 92976000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=6
NOTE: Invalid data for Payroll in line 77 1-5.
NOTE: Invalid data for Win in line 78 1-5.
 
78 CHAR 86.86
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 86986000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=7
NOTE: Invalid data for Payroll in line 79 1-5.
NOTE: Invalid data for Win in line 80 1-5.
 
80 CHAR 84.83
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 84983000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=8
NOTE: Invalid data for Payroll in line 81 1-5.
NOTE: Invalid data for Win in line 82 1-5.
 
82 CHAR 81.77
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 81977000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=9
NOTE: Invalid data for Payroll in line 83 1-5.
NOTE: Invalid data for Win in line 84 1-5.
 
84 CHAR 71.91
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 71991000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=10
NOTE: Invalid data for Payroll in line 85 1-5.
NOTE: Invalid data for Win in line 86 1-5.
 
86 CHAR 62.85
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 62985000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=11
NOTE: Invalid data for Payroll in line 87 1-5.
NOTE: Invalid data for Win in line 88 1-5.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
 
88 CHAR 61.69
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 61969000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=12
NOTE: Invalid data for Payroll in line 89 1-5.
NOTE: Invalid data for Win in line 90 1-5.
 
90 CHAR 57.80
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 57980000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=13
NOTE: Invalid data for Payroll in line 91 1-5.
NOTE: Invalid data for Win in line 92 1-5.
 
92 CHAR 52.81
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 52981000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=14
NOTE: Invalid data for Payroll in line 93 1-5.
NOTE: Invalid data for Win in line 94 1-5.
 
94 CHAR 35.57
ZONE 33033222222222222222222222222222222222222222222222222222222222222222222222222222
NUMR 35957000000000000000000000000000000000000000000000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Payroll=. Win=. _ERROR_=1 _N_=15
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.PAYROLL has 15 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
95 ;
 
96 proc print;
97 run;
 
NOTE: There were 15 observations read from the data set WORK.PAYROLL.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.03 seconds
cpu time 0.05 seconds
 
 
98
99 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
112
 
I even cleaned the cache....still doesn't work
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Try starting a new session.  Things can get stuck in the session, like missing quotes and such like.  If it does it with a fresh session show the whole log.

 

Oh, and don't forget to put the run; after the semicolon in the first datastep - not required, but always good practice and can avoid other issues if you always put run;, and put dots after macro varaibles, and close quotes proplerly etc.

NewSASUser17
Calcite | Level 5

Thank you  RWA for the suggestion to put run earlier as well. I did try another session and got stuck...in fact I tried rerunning quite a few times...I am not very SAS savvy yet and not being able to troubleshoot is really not helping me

RW9
Diamond | Level 26 RW9
Diamond | Level 26

As per @ballardw, post the log.  Check where the code is coming from.  Something is amis there as your code seems fine, but we cannot debug without some info.

ballardw
Super User

It almost always helps to show the code and notes from the log, pasted into a code box using the forum {I} menu icon to preserve formatting.

 

Did you by any chance copy and paste either the code or the data lines from another document? A moderately common problem is copying from a source that is not a plain text editor (web page, word processing document, PDF or such) and while the result may look like text it can contain hidden characters that cause issues with executing code.

 

I have found examples of this issue where the offending codes appeared in the middle of numeric values as well as text, so nothing is safe...

NewSASUser17
Calcite | Level 5

I didn't see {i} option...using to share my code again

data Payroll;
Input Payroll Win;
datalines;
206	95
162	89
146	75
142	97
134	79
123	81
106	88
105	80
99	92
98	94
95	80
92	76
86	61
86	86
84	91
84	83
82	66
81	77
72	96
71	91
71	67
62	85
61	65
61	69
61	69
57	80
55	90
52	81
38	90
35	57
;
proc print;
run;
Tom
Super User Tom
Super User

You probably have TABS in your data lines. 

Either replace them with spaces or add an INFILE statement so you can specify the DLM= or EXPANDTABS options.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 8 replies
  • 2485 views
  • 0 likes
  • 5 in conversation