Proc sql;
select * from mytable
where income < 0;
run;
Show the results of Proc Contents on your data set Mytable. If you think you have negative values and none appear than one likely cause is that the variable Income is character and not numeric, second could be a custom format that displays something you think is negative but actually holds a different value.
BTW, Proc SQL ends with a Quit statement not Run. Should create output but you may still have proc sql running.
The code looks fine. Please add some sample data to your question which shows this behavior, e.g.:
data mytable ;
income = -1 ;
run ;
proc sql;
select * from mytable
where income < 0;
quit;
Maxim 3: Know Your Data.
This includes knowing all types, formats and other attributes of your variables.
Income < 0, what does that even mean? Somebody who goes to work, the company doesn't pay the worker and the worker has to pay the company money, so his income is negative? Maybe your data set doesn't have any records where Income < 0 because that never happens.
If the code you show finds zero records, then there are no incomes less than zero in your data set.
Show the results of Proc Contents on your data set Mytable. If you think you have negative values and none appear than one likely cause is that the variable Income is character and not numeric, second could be a custom format that displays something you think is negative but actually holds a different value.
BTW, Proc SQL ends with a Quit statement not Run. Should create output but you may still have proc sql running.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.