Sync everything up, at least between EG & metadata

0

From an Enterprise Guide user's perspective, a SAS library is a library. Whether it was defined in the autoexec or in the metadata or by magic, it is there for them to use with no issues. However, there is a difference as metadata defined libraries do not behave in the same manner. In some circumstances (say when allowing users to create data in the library using the metaout=data or the assignmode=2), you either rely on the user to complete the 2nd step of updating the metadata themselves or risk having everything out of sync. Changes to a table by an EG user will not be viewable and worse yet could confuse a Web Report attempting to use the same table.

Might I suggest an alternative. Create proc metalib code to update all the libraries the user has access to change, and place this in the workspace server autoexec (SAS Config Folder\\Lev1\\SASApp\\WorkspaceServer\\autoexec_usermods.sas). Included is a sample to loop through all the libraries, since you must point to a single location with each run of the proc metalib code.

/*retrieve all metadata library names*/
data metadata_libraries;
  length liburi $256 name $128 ;
  keep name;
  call missing(liburi,name);
 
	nlibobj=1;
    librc=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",nlibobj,liburi);
  do while (librc>0);
     rc=metadata_getattr(liburi,'Name',name);
	 output;
	 /* Look for another library */
	 nlibobj+1;
     librc=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",nlibobj,liburi);
  end; /* do while (librc>0) */
run;
/*create macro loop for processing metadata updates*/
%macro reg(name);
proc metalib;
omr (library="&name");
folder="/Data/&name";
run;
%mend;
 
/*now run the loop via proc execute*/
data _null_;
set metadata_libraries;
call execute('%reg('||name||');');
run;

Make sure the user has WriteMetadata access to the library location in the metadata folder structure. Also verify that they do not have WriteMetadata access to any libraries that should not be modified by the users. In this scenario, I have given all SASUSERS WriteMetadata access to everything in the Data folder.

Also, as with any autoexec file change, restart the object spawner to see the new code.

I had asked my SAS Admin to register the Best Movies data table into metadata. Typical of my enthusiasm for getting the task done, I realized that year was included in the name and I really wanted them separated, without calling the SAS Admin late in the evening I was able to register the table automatically when I opened EG back up the next time.

Share

About Author

Angela Hall

Senior Technical Architect

Angela offers tips on using the SAS Business Intelligence solutions. She manages a team of SAS Fraud Framework implementers within the SAS Solutions On-Demand organization. Angela also has co-written two books, 'Building BI using SAS, Content Development Examples' & 'The 50 Keys to Learning SAS Stored Processes'.

Related Posts

Comments are closed.

Back to Top