BookmarkSubscribeRSS Feed
George_S
Fluorite | Level 6

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;

6 REPLIES 6
George_S
Fluorite | Level 6

I didn't find any discussion relate to this problem.

Haikuo
Onyx | Level 15

What kind of error message?

George_S
Fluorite | Level 6

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.

Haikuo
Onyx | Level 15

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;

George_S
Fluorite | Level 6

Thank you Hai.Kuo,

Is there any hotfix for SAS9.1.3 to solute this problem ?

Haikuo
Onyx | Level 15

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 2253 views
  • 6 likes
  • 2 in conversation