Hi, I am currently studying for the SAS advanced programing exam. One of the practice questions has the following answer but when I try to run the code I get the below error. I tried changing the name of the hash object to something else but that didn't work.
ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase.
ERROR 558-185: Reference definedate is not a member of object c.
DATA examples
work.continent
ID CtName
91 North America
93 Europe
work.airports
ID City Code Aname Country
91 Anchorage, AK ANC Anchorage International Airport USA
93 Stockholm ARN Arlanda Sweden
CODE:
Data work.success work.fail;
drop rc;
length CtName $30;
If _N_=1 then do;
Call missing (CtName);
declare hash c(dataset:'work.continent');
c.definekey('ID');
c.definedate('CtName');
c.definedone();
end;
set work.airports;
rc=c.find();
if rc=0 then output work.sucess;
else output work.fail;
run;
Proc print data=work.sucess;
run;
Proc print data=work.fail;
run;
run;
Hi @TennisKM3,
Just two typos:
Hi @TennisKM3,
Just two typos:
Thanks! Spelling gets me every time.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.