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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.