Desktop productivity for business analysts and programmers

Metadata Column description

Reply
Occasional Contributor
Posts: 15

Metadata Column description

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
Community Manager
Posts: 2,889

Re: Metadata Column description

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
Occasional Contributor
Posts: 15

Re: Metadata Column description

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("omsobjSmiley Very HappyatabaseSchema?@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
Ask a Question
Discussion stats
  • 2 replies
  • 718 views
  • 0 likes
  • 2 in conversation