Hi Tom,
Thank you for your response. You are right; I am having trouble communicating the problem.
Step 1 and 2 are no issues. I am able to generate a list of variable names, review the list, and identify the renaming that is required as seen below.
Dataset 1:
Dataset 2:
data new;
set contents_&file.;
if upcase(name) in ('ADDRESS1' 'ADDRESS2' 'BUSNAME' 'CITY'
'COUNTY' 'FNAME' 'LNAME' 'MI' 'STATE' 'ZIP' 'ZIP4')
then basename='Prov'||name; else basename=name;
run;
I want to rename txnmy_cd and spec_cd using a numeric suffix since they have more than one instance of the variable beginning with:
Taxonomy, Taxonomy2, Taxonomy3, etc.
ProvSpec1, ProvSpec2, ProvSpec3, etc.
I also want to remove the underscore from prov_type also.
In addition, I am trying to remove those weird naming conventions in dataset 2 (e.g. CountyA_B, PCP_flagD) to follow the format of dataset 1.
I was considering the use of index function to do this. I'm not sure if there is a more efficient way.
Also, dataset 2 is slightly different so the code listed above won't work on that dataset. Using this function below, I don't know if this quite works for my address and zip variables.
basename = prxchange('s/\d*$//',-1,trim(name));
I think once I am able to produce a column right next to the original name column, I can use proc sql to rename the column variables as the new column variables.
... View more