BookmarkSubscribeRSS Feed
Pavan_SAS
SAS Employee
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.
2 REPLIES 2
deleted_user
Not applicable
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 ;
deleted_user
Not applicable
..

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 868 views
  • 0 likes
  • 2 in conversation