Your SAS programs, embedded in web apps and elsewhere

PROC METADATA

Reply
SAS Employee
Posts: 73

PROC METADATA

Hello,

We are asked to update the Column length of a variable (say XYZ) in the metadata using PROC METADATA.

This column is present in various datasets across different stages/layers.

So far we’re able to get the Repository ID, Physical table IDs and Column IDs of XYZ from all the datasets.

Now we need to update the Column length of XYZ in all those datasets in the metadata.

Kindly help us on updating the column length in the metadata. Also let us know if there are any key factors we need to consider while performing this action.

Response will be appreciated.
N/A
Posts: 0

Re: PROC METADATA

Posted in reply to Pavan_SAS
Firstly, have you also considered your 'ExternalTables' and/or 'WorkTables'???, you will most likely have lots of these also containing columns which you will need to update.

I'd recommend you take a look at http://www2.sas.com/proceedings/forum2008/134-2008.pdf before you do anything.


To update your columns, you simply need to specify the following statement for each column inside an UpdateMetadata request :



How you do the update statement is up to you, but personally i'd use the Metadata Utility, where you just select the UpdateMetadata tab, paste in your column statements as defined above and hit execute. Voila, job done.

If you want to go through the code route, you want something like this (I won't go into detail as I'm sure you'll work it out) :

data _null_;

set work.newcols end=done;
file ColsXML;

if _n_ = 1 then
put '' /
' '
;

str = ' ' SASColumnLength="' || compress(SASColumnLength) || '"' || '"/>'
;

if done then
put '
' /
'A0000001.A50URHMK' /
'SAS' /
'268435456' /
'' /
'
'
;
run;

proc metadata in=ColsXML ;
run ;
N/A
Posts: 0

Re: PROC METADATA

Posted in reply to Pavan_SAS
..
Ask a Question
Discussion stats
  • 2 replies
  • 214 views
  • 0 likes
  • 2 in conversation