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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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