tags:

views:

196

answers:

2

Hi,

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.

A: 

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
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
A: 

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