data master;
input dt $ dept $ sales;
datalines;
DEC-2013 PC 2000
NOV-2013 PC 1500
DEC-2012 MOBILE 3000
;
run;
DATA lkup;
input dept $ percent; datalines;
PC 0.4
MOBILE 0.6 ;
run;
proc sql;
create index dept on lkup(dept);
quit;
data merged;
set master;
set lkup key=dept;
x=_IORC_;
run;
I am getting error on second row, it should find match and no error is reported. Can anyone explain me what's wrong in the code?
dt=NOV-2013 dept=PC sales=1500 percent=0.4 x=1230015 _ERROR_=1 _IORC_=1230015 _N_=2
Try adding /UNIQUE option.
set lkup key=dept / unique;
Works. Thanks a bunch.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.