BookmarkSubscribeRSS Feed
yabwon
Amethyst | Level 16

Hi SAS-C!

I have a favour to ask.

 

Could you be so kind and run the following snippet in your SAS and share the log output?

%put &sysvlong.;
data _null_;
  declare hash H;
  H = _new_ hash();
  put _all_;
run;

 

 

I'm trying to figure out at what "M" SAS stopped to print out hash object variable and its value in the log.

I know form @hashman it was printable in 9.4M4.  I've checked, it was "visible" in older versions too.

 

I did tests on M7:

1          %put &sysvlong.;
9.04.01M7P080620
2          data _null_;
3            declare hash H;
4            H = _new_ hash();
5            put _all_;
6          run;

_ERROR_=0 _N_=1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

and M8:

1    %put &sysvlong.;
9.04.01M8P011823
2    data _null_;
3      declare hash H;
4      H = _new_ hash();
5      put _all_;
6    run;

_ERROR_=0 _N_=1
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      user cpu time       0.00 seconds
      system cpu time     0.01 seconds
      memory              364.87k
      OS Memory           29952.00k

also on Workbench for Learners:

1    %put &sysvlong.;
V.04.00M0P020625
2    data _null_;
3      declare hash H;
4      H = _new_ hash();
5      put _all_;
6    run;

_ERROR_=0 _N_=1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              442.12k
      OS Memory           16740.00k

and Viya for Learners:

1    %put &sysvlong.;
V.04.00M0P091624
2    data _null_;
3      declare hash H;
4      H = _new_ hash();
5      put _all_;
6    run;
_ERROR_=0 _N_=1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

 

 

Interesting is that on EG8 data step debugger, under SAS9.4M8, hash object variable is "visible":

yabwon_1-1744294530893.png

It looks that also with SAS Studio (on VFL) we can see it, but in contrary to EG, Studio "fails" to proceed:

yabwon_2-1744294791917.png

 

 

Thank in advance!

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



4 REPLIES 4
Tom
Super User Tom
Super User

The most obvious reason is the hash objects are not included in the list of variables when you use the _ALL_ shortcut in the PUT statement.

 

But there is a good reason why they aren't included.  What the heck would it write to the LOG?

30    data _null_;
31    declare hash H;
32    H = _new_ hash();
33    put _all_;
34     put h=;
ERROR: Invalid operation for object type.
35   run;

NOTE: The SAS System stopped processing this step because of errors.
yabwon
Amethyst | Level 16

 

In older versions, you can see something like this:

1  data _null_;
2    declare hash H;
3    H = _new_ hash();
4    put _all_;
5  run;

H=5.6817E-299 _ERROR_=0 _N_=1
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds

Bart

 

P.S. BTW, if you run:

data _null_ / PMML; /* PMML option */
  declare hash H;
  H = _new_ hash();
run;

you will see:

Symbol=H kind=? type=T_OBJECT

in the LOG:

1    data _null_ / PMML;
2      declare hash H;
3      H = _new_ hash();
4    run;

NOTE: Generating PMML.

--------------- Symbol table ------------------

21: Symbol=_THREADID_ kind=K_IDENTIFIER type=T_REAL
 - retain
 - internal

23: Symbol=_FILE_ kind=K_IDENTIFIER type=T_CHARACTER
 - retain
 - pseudovariable
 - internal

47: Symbol='.'n kind=K_REAL_CONSTANT type=T_REAL

49: Symbol='0'n kind=K_REAL_CONSTANT type=T_REAL

50: Symbol='1'n kind=K_REAL_CONSTANT type=T_REAL

62: Symbol=_NTHREADS_ kind=K_IDENTIFIER type=T_REAL
 - retain
 - internal

74: Symbol=H kind=? type=T_OBJECT
 - internal

131: Symbol=_RANKID_ kind=K_IDENTIFIER type=T_REAL
 - retain
 - internal

141: Symbol=_IORC_ kind=K_IDENTIFIER type=T_REAL
 - retain
 - internal

174: Symbol=_NRANKTHREADS_ kind=K_IDENTIFIER type=T_REAL
 - retain
 - internal

189: Symbol=_NRANKS_ kind=K_IDENTIFIER type=T_REAL
 - retain
 - internal

237: Symbol=_INFILE_ kind=K_IDENTIFIER type=T_CHARACTER
 - retain
 - pseudovariable
 - internal

263: Symbol='#macbig'n kind=K_REAL_CONSTANT type=T_REAL

264: Symbol='DATASTEP.HASH'n kind=K_CLASSOBJECT type=T_OBJECT
 - internal

270: Symbol='#macseps'n kind=K_REAL_CONSTANT type=T_REAL

278: Symbol='#macnbig'n kind=K_REAL_CONSTANT type=T_REAL

312: Symbol=_RANKTHREADID_ kind=K_IDENTIFIER type=T_REAL
 - retain
 - internal

322: Symbol='BASE.OBJECT'n kind=K_CLASSOBJECT type=T_OBJECT
 - internal

357: Symbol=_HOSTNAME_ kind=K_IDENTIFIER type=T_CHARACTER
 - retain
 - internal

384: Symbol=_N_ kind=K_IDENTIFIER type=T_REAL
 - retain
 - internal

443: Symbol=_ERROR_ kind=K_IDENTIFIER type=T_REAL
 - retain
 - internal

504: Symbol='V@0'n kind=? type=T_OBJECT
 - internal

end of symbol table

NOTE: Writing HTML Body file: sashtml1.htm
NOTE: Finished PMML.
NOTE: DATA statement used (Total process time):
      real time           0.34 seconds
      user cpu time       0.14 seconds
      system cpu time     0.17 seconds
      memory              6924.71k
      OS Memory           29952.00k

 

 

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



data_null__
Jade | Level 19

VNEXT sees the hash object.

 

9.04.01M8P011823
73         data _null_;
74           declare hash H;
75           H = _new_ hash();
76           put _all_;
77           length _name_ $32 type $1;
78           do until(missing(_name_));
79              call vnext(_name_,type,length);
80              put 'NOTE: ' (_all_)(=);
81              end;
82         run;

_name_=  type=  length=. _ERROR_=0 _N_=1
NOTE: _name_=H type=  length=0
NOTE: _name_=_name_ type=C length=32
NOTE: _name_=type type=C length=1
NOTE: _name_=length type=N length=8
NOTE: _name_=_ERROR_ type=N length=8
NOTE: _name_=_N_ type=N length=8
NOTE: _name_=  type=  length=0
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
yabwon
Amethyst | Level 16

The VNEXT(), ha! I forgot! 

@data_null__, thanks a 1e6!!

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 900 views
  • 4 likes
  • 3 in conversation