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!
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.
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:
I even cleaned the cache....still doesn't work
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.
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
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.
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...
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;
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.