Hi there,
I'm a novice sas user. A past colleague wrote some sas code for me to format some data. The code works but gives a warning, does the code need changing to remove the error?
WARNING: THE VARIABLE INFO IN THE DROP, KEEP, OR RENAME LIST HAS NEVER BEEN REFERENCED
The warning related to this line of code
%looping;
which is at the end of the whole code.
This is the whole code:
Many thanks
It's a WARNING not an ERROR which means it's "ugly" but your code will still fully execute.
You get this warning because in your code you attempt to DROP a variable that doesn't exist. Variable INFO doesn't get created in your data step and it obviously also doesn't pre-exist in your input table &filename.
You could just remove INFO from your drop statement.
It's a WARNING not an ERROR which means it's "ugly" but your code will still fully execute.
You get this warning because in your code you attempt to DROP a variable that doesn't exist. Variable INFO doesn't get created in your data step and it obviously also doesn't pre-exist in your input table &filename.
You could just remove INFO from your drop statement.
@Biffothebear Just fyi: SAS system option DKROCOND allows you to change how SAS behaves if dropping a non existent variable.
I'm of the opinion that one should write code that doesn't get into such a situation but just in case below a code sample how you could suppress the warning.
/* store current setting for option dkrocond in macro variable &sv_dkrocond */
%let sv_dkrocond=%sysfunc(getoption(dkrocond,keyword));
/* set option to nowarning */
options dkrocond=nowarning;
data have;
set sashelp.class;
drop VarDoesNotExist;
run;
/* restore dkrocond to previous value */
options &sv_dkrocond;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.