Hello all,
I have a large dataset in which I would like to change the label names of multiple columns to match the variable names. For example, I have 5 variables named new_diag_1, new_diag_2, new_diag_3, new_diag_4, new_diag_5. When I run a proc contents I see that the labels for each of these 5 variables is just new_diag. I would like the label to be the same as the variable name for each new_diag_1-5 variable.
Note: In my actual dataset I have about 10-20 more variables that I will need to change the labels to match the variable names (some of the var names will have the same prefixes, e.g., new_treatment_1-5, new_dr_1-5, etc.)
I know I can rename each label by writing it out like the code below but I'm wondering if there's an easier way to change the name for multiple labels with the same prefixes. Any help is appreciated!
proc sql;
create table want as
select new_diag_1 label = 'new_diag_1'
from have;
run;
quit;
... View more