|
have a look at sashelp.vcolumn in display manager, or in batch
proc sql;
create my_names as select * from dictionary.columns
where libname="&mylib" and memname="&mymem"
; /* ensure &mylib and &mymem are uppercase */
select trim( name ) !! '= CA_' !! trim( name )
into :renames separated by ' '
from my_names
order by varnum
;
quit;
proc datasets library = &mylib ;
modify &mymem label="variables with new names";
rename &renames ;
run;
quit;
Datum: 15/03/2001 19:46
An: SAS-L@listserv.uga.edu
Antwort an: ouisc@yahoo.com
Betreff: Adding Prefix to Variable Names
Nachrichtentext:
Good morning,
I am working on a data set containing hundreds of observations as well as
hundreds of variables. My ultimate goal is to add three characters, "CA_"
as a prefix to all my variable names.
My plan has been to use PROC TRANSPOSE to create the variable _NAME_, which
I'm able to manipulate, and then PROC TRANSPOSE everything back producing
the new manipulated variable names. But I've run into a simple problem
here. I'd have to VAR the entire list of variables so that character
variables are also transposed.
Is there an easier way to accomplish this task other than PROC TRANSPOSE?
And if not, is there an easy way to produce a list of variable names that
would be easy to cut and paste into a VAR statement?
Craig Gale
Biostatistician
Marshfield Clinic
Marshfield, Wisconsin
--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
|