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;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.
Ready to level-up your skills? Choose your own adventure.