Hi,
I had problems when running the following code. The log showed 'WARNING: The variable AGE in the DROP, KEEP, or RENAME list has never been referenced.'.
The dataset 'a1', '_age_v1' has already existed. I did not include the information of these datasets because they have nothing to do with the problem. I simplified my coding as well.
_______________________________________________________________________
%let AGE = %str(attrib AGE length = 8 format = 3. label = "Age";);
%let AGEU = %str(attrib AGEU length = $25 format = $25. label = "Age Units";);
data temp;
&AGE &AGEU;
set a1;
if (_n_ eq 1) then do;
declare hash b2(dataset: "_age_v1"); b2.defineKey("STUDYID" ); b2.defineData("age", "ageu"); b2.defineDone(); call missing(age, ageu);
end;
run;
data xx.test;
retain STUDYID SUBJID SITEID AGE AGEU;
set temp;
keep STUDYID SUBJID SITEID AGE AGEU;
run;
____________________END_____________________
Thanks!
Suvan
I think the log is pretty self explanatory? The warning happens because you try to keep a variable that has not been referenced. Like below. The variable x is not in SASHELP.CLASS, so the Warning happens.
data test;
set sashelp.class;
keep x;
run;
More importantly.. What are you trying to do here? There are quite a lot of stuff in your code that makes little sense 🙂 Like creating a hash object you do not use. I'll be happy to help you.
1. Please show us the full log
2. Please format your code and the log text by using the appropriate icons
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.