When using EG import wizard, ticking the box "rename columns to comply with SAS naming conventions", SAS will rename all unconventional column names.
I want to apply the same logic to all values in a dataset, because those values will be used as reference for some further operations.
But I'm not sure how EG import wizard renames columns. What is the logic?
I am only able to pick up some:
However I believe it is not the whole picture, because I've run a sample test:
/* before */
One Two Three Four Five Six Seven Eight
One Two Three Four Five Six Seven Nine
One_Two_Three_Four_Five_Six_Seven_Nine
/* after */
One_Two_Three_Four_Five_Six_Seve
One_Two_Three_Four_Five_Six_0001
One_Two_Three_Four_Five_Six_Sev0
Are you implying the data values in one data set are supposed to be the column names in another?
IF that is the case then I wouldn't touch any of this with proc import but would control the variable names with a data step to read the data and then create a custom informat with information from one table to map the values to the desired names.
If this is not the case then maybe you should provide some example data values that need this approach as I am somewhat confused.
Note that the exact same long variable names may get mapped to different values in different proc import results if the order of the variables changes. Also in the case some column headers where the text for the first 40 or so plus characters are the same you will sometimes get a resulting name of VARXXX where the XXX is the column number because the renaming algorithm just gives up.
Are you implying the data values in one data set are supposed to be the column names in another?
IF that is the case then I wouldn't touch any of this with proc import but would control the variable names with a data step to read the data and then create a custom informat with information from one table to map the values to the desired names.
If this is not the case then maybe you should provide some example data values that need this approach as I am somewhat confused.
Note that the exact same long variable names may get mapped to different values in different proc import results if the order of the variables changes. Also in the case some column headers where the text for the first 40 or so plus characters are the same you will sometimes get a resulting name of VARXXX where the XXX is the column number because the renaming algorithm just gives up.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.