BookmarkSubscribeRSS Feed
Kurt_Bremser
Super User

When using the OUTPUT() method to write a dataset to a metadata-bound and encrypted library, the dataset ends up with zero observations and zero variables. Using the identical code to write to a "normal" library (e.g. WORK) produces the expected dataset with observations and variables as stored in the hash object.

There is a peculiar difference in the log:

Successful:

28         data _null_;
29         set sashelp.class end=done;
30         if _n_ = 1 then do;
31           declare hash c ();
32           c.definekey("name");
33           c.definedata("name","sex");
34           c.definedone();
35         end;
36         rc = c.add();
37         if done then rc = c.output(dataset:"class");
38         run;
 
NOTE: The data set WORK.CLASS has 19 observations and 2 variables.
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE:  Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
      real time           0.01 seconds
      cpu time            0.00 seconds
 

Not successful, with MBL:

28         data _null_;
29         set sashelp.class end=done;
30         if _n_ = 1 then do;
31           declare hash c ();
32           c.definekey("name");
33           c.definedata("name","sex");
34           c.definedone();
35         end;
36         rc = c.add();
37         if done then rc = c.output(dataset:"xxxx.class");
38         run;
 
NOTE: Metadata-bound library permissions are used for XXXX.CLASS.DATA.
NOTE: Successfully added new secured table object with SASTableName and MemberType "CLASS.DATA" to the secured library object at
      path "/System/Secured Libraries/XXXX/XXXX" for data set XXXX.CLASS.DATA.
NOTE: This metadata-bound library requires AES encryption with its recorded key. The recorded algorithm is used.
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set XXXX.CLASS has 0 observations and 0 variables.
NOTE:  Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
      real time           0.03 seconds
      cpu time            0.02 seconds

(library name redacted).

As you can see, there may be a timing issue involved, as the success reports the output dataset first, while the failure reports it last.

 

A track will be opened with SAS Technical Support.

 

PS the issue was encountered on SAS 9.4M7 on AIX.

3 REPLIES 3
mkeintz
PROC Star

Out of curiousity.

 

"metadata-bound and encrypted"?   I presume that metadata-bound and unencrypted will properly honor the output method, yes?   (I've never had to work in the metadata-enable sas environment).  

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Kurt_Bremser
Super User

I can only state this for MBL and encrypted. All our permanent libraries are MBL and encrypted because our server farm is outsourced (external people have superuser access, so we need to protect our data). It may be that it is the encryption, but it may also be that the MBL alone is the deciding factor in this.

SASKiwi
PROC Star

@Kurt_Bremser  - I note you are testing with a SASHELP dataset which I assume is a non-MBL. Just out of curiosity do you get the same behaviour both reading from and writing to an MBL?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 511 views
  • 2 likes
  • 3 in conversation