Hello Everybody!
The SAS code in the below or attachment will cause error in SAS 9.1.3 but it won't cause error at SAS 9.2.Is there anybody have ever met the same kind problem before? Is there any solution?
Thanks a lot!
George
data Base;
input id $ amount;
datalines;
a 189
b 160
b 188
b 165
a 145
a 199
b 198
b 345
c 298
c 165
d 235
d 678
e 161
e 285
f 278
;
data Name;
input id $ name $ n;
datalines;
a Jose 1
b Hose 2
c Jerry 3
d Sara 4
e Tom 5
;
data test6(drop=rc);
if 0 then set name;
if _n_ = 1 then do;
dcl hash h(dataset: 'name (where=(n < 3))');
h.definekey("id");
h.definedata("id","name",'n');
h.definedone();
end;
do until(eof);
set base end=eof;
name='';
rc=h.find();
output;
end;
run;
I didn't find any discussion relate to this problem.
What kind of error message?
ERROR: The value NAME (WHERE=(N < 3)) is not a valid SAS name.
ERROR: Hash data set load failed at line 35 column 3.
ERROR: DATA STEP Component Object failure. Aborted during the EXECUTION phase.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 1 observations read from the data set WORK.BASE.
WARNING: The data set WORK.TEST6 may be incomplete. When this step was stopped there were 0
observations and 4 variables.
It should be casued by where option.
Apparently data set options are not supported in hash() when SAS 9.1.3. You will have to remove the options and split it up:
data name1;
set name (where=(n<3));
run;
data test6;
if 0 then set name1;
if _n_ = 1 then do;
dcl hash h(dataset: 'name1');
h.definekey("id");
h.definedata("id","name",'n');
h.definedone();
end;
do until(eof);
set base end=eof;
name='';
rc=h.find();
output;
end;
run;
Thank you Hai.Kuo,
Is there any hotfix for SAS9.1.3 to solute this problem ?
Not I am aware of. It is not a bug, it is just not supported. If you are keen on hash, you have to upgrade, the difference is day and night, before 9.2, I don't even bother with hash.
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.