0

I have a SAS application that I am testing with the newly released SAS 9.2. I have a call to the metadat_newobj function to create a new Library object in the SAS metadata repository:

rc = metadata_newobj( "SASLibrary", URI, Name );

In 9.1.3, when the function executed successfully (rc = 0), the URI variable was populated with the URI of the newly created Library object.

In SAS 9.2, although the return value is 0 (Successful) and the Library object does get created (I checked manually using the management console), the URI variable stays blank so any subsequent operations to set attributes etc fail.

The documentation for both versions lists URI as an output parameter of this function.

Does anyone have any knowledge of this?

EDIT: The code I was using is as follows:

put libraryName=;
rc = metadata_newobj("SASLibrary", libraryUri, libraryName);
if rc ne 0 then do;
  /* Error handler */
  return;
end;
put libraryUri=;

and the output:

libraryName=HRLIB10
libraryUri=

I'm trying to work around this using PROC METADATA instead, which seems to be working. :\

EDIT #2: I just realized that I have not mentioned that this is within SCL code.

Allan Bowe
  • 12,306
  • 19
  • 75
  • 124
Adnan
  • 2,949
  • 4
  • 29
  • 45
  • Looks like a question for SAS.. Sorry we can't be of more help. – AFHood Apr 11 '09 at 16:49
  • Yea, I do plan on opening a support ticket with them on Monday, but I figured I'd try here and see if any SAS folks lurked or others had a similar issue. Thanks. :) – Adnan Apr 11 '09 at 17:12

2 Answers2

1

It worked for me. Based on the example you gave I'd suggest putting quotes around NAME. Also maybe use a length statement to setup uri prior to running metadata_newobj. Otherwise, in the interest of sharing, let us know if you get it resolved with some other technique.

Here's what I ran:

data _null_;
    length uri $256;
    rc=0;
    rc=metadata_newobj("SASLibrary",
                       uri,
                       "testlib");
    put uri=;
run;

Here's my log:

NOTE: Variable uri is uninitialized.
uri=OMSOBJ:SASLibrary\A5M6IOB0.AZ000007
NOTE: DATA statement used (Total process time):
      real time           0.07 seconds
      cpu time            0.01 seconds
cmjohns
  • 4,465
  • 17
  • 21
  • Added my code fragment to the question. My "Name" is a variable and URI was declared before. By the way, I forgot to mention that I was using it within SCL code. – Adnan Apr 13 '09 at 20:45
0

I didn't find anything that suggests metadata_newobj had changed in the new version. However, it just refused to work for me. So I converted my functions to use PROC METADATA and now it works in SAS 9.1.3 and SAS 9.2

Thanks all.

Adnan
  • 2,949
  • 4
  • 29
  • 45
  • Sorry, I no longer work at the same place I did when this was posted, so I don't have access to the actual code anymore. It's been a while since I did SAS coding, so I don't have a working SAS environment to recreate this either :\ – Adnan Nov 11 '16 at 02:34