BookmarkSubscribeRSS Feed
Ebele
Obsidian | Level 7
Is there a way to display the Column Description as it is registered in the metadataserver, instead of the column labels or the column names?

Thanks,
Ebele
2 REPLIES 2
ChrisHemedinger
Community Manager
Yes.

Select Tools->Update Library Metadata (don't worry, we're not going to actually update anything).

On the first page of the wizard, select the library that contains the table you care about.

On the second page, accept the default option of "Report on the contents of the library, as registered in the metadata repository".

Then click Finish. The resulting report should contain the information you need.

If you would rather have a SAS program to do this, try running this (replacing your libref and library name at the top):

[pre]
%let libref = NEWCHOC;
%let metaLibName = Appalachian Chocolates;

/* free the library if it is currently assigned */
%macro cleartemplib(libtofree);
%if %sysfunc(libname(&libtofree)) ne 0 %then
%put NOTE: Libref &libtofree could not be unassigned;
%else
%put NOTE: Libref &libtofree has been unassigned;
%mend;

/* clear existing definition, if any */
%cleartemplib(&libref);

/* ensure library is assigned */
libname &libref meta library="&metaLibName";

/* list contents of the library, according to the metadata */
ods noproctitle;
title "Contents of library ""&metaLibName""";
proc datasets lib=&libref memtype=(data view) nolist;
contents data=_all_ varnum ;
run;
quit;
ods proctitle;
title;
[/pre]

Chris
SAS Hackathon registration is open! Build your skills. Make connections. Enjoy creative freedom. Maybe change the world.
Ebele
Obsidian | Level 7
Hi Chris,
Thanks.

I have a SQL Server table which I register in the metadata.
I want to add column labels (a description) to the registered SQL table.

The piece of SAS code which does the trick:

data _null_;
length uri urik $256
id_table $256
desc $256
naam_tabel $32
NameColumn $256;
rc=1;arc=0; n=1;

do while(rc>0);
rc=metadata_getnasn("omsobj:DatabaseSchema?@Name = 'CDW'", "Tables", n, uri);
arc=1;
if (rc>0) then do;
arc=metadata_getattr(uri,"ID",id_table);
brc=metadata_getattr(uri,"Name",naam_tabel);
end;
if (arc=0) then put id_table=;
rck=1;
k=1;
do while (rck>0);
rck=metadata_getnasn("omsobj:"!!compress(id_table), "Columns", k, urik);
rcn = metadata_getattr(urik, 'Name', NameColumn);
rcm = metadata_getattr(urik, 'Desc', desc);
rcaap=metadata_setattr(urik,"Desc","Test label description");
put "Label=" desc " Name column: " NameColumn;
k+1;
end; /* while rck>0 */
n=n+1;
end;
run;

Now you have the description in the metadata and I was looking for a way to use it in Enterprise guide when viewing tables.
At a first glance I thought Enterprise Guide ignored the description field.
But after reconnecting to the metadataserver the description field is displayed.


Regards,
Ebele

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 2965 views
  • 0 likes
  • 2 in conversation