- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't understand what you want.
If the names were changed because they were too long how do you expect to change them back to longer names?
Names can be up to 32 bytes long. Labels can be up to 256 bytes long.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. Basically, I am looking for a better way to automatically renaming a variable if its length over 20 characters. I guess that several steps are needed to do so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@nnl3256 wrote:
Thank you. Basically, I am looking for a better way to automatically renaming a variable if its length over 20 characters. I guess that several steps are needed to do so.
The best way is to get whoever created the crazy names to begin with to come up with names that use a normal maximum length. 20 characters sounds like a reasonable upper bound on the length of the names, hopefully most of them can use much shorter names.
The normal process that people use is to turn english phrases like you have in your labels into names is to follow something like:
- Remove unneeded words like A THE AND
- Replace long words with common abbreviations.
- As a last resort start appending numeric suffixes to keep names distinct
Note you could also look into modifying the process for create the longer names so that they are distinct in the first XX (for example 20) characters. Then if you need to use an automatic process to truncate the names to fit into a system that does not allow paragraphs as names you don't have to worry about it causing name conflicts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
And don't forget acronyms based on recurring words in your data.
I have a data source that had Primary_Care_Giver_ and Secondary_Care_Giver followed by Last_name, First_name, Date_of_Birth, and a bunch of other characteristics.
So Primary_Care_Giver_ became PCG_ and Secondary_Care_Giver became SCG_ .
You may find this code helpful in finding likely words to abbreviate. Replace YOURLIB with the uppercase name of your Library to get a list of all of the words in your labels by frequency in the proc freq output.
Proc sql; create table work.labels as select label from dictionary.columns where libname='YOURLIB' ; run; data work.words; set work.labels; length word $ 20; do i= 1 to countw(label); word = scan(label,i); output; end; drop label; run; Proc freq data=work.words order=freq; table word /nocum; run;