Hi all,
Just wondering if anyone was aware of a SAS setting (so within Base SAS itself or the like) that changes the default variable naming settings when doing any sort of importing (whether that be through proc import of an excel, or just using a data step to set a access database)
Since about a month ago, whenever I try importing things using the above, the variable names are not being assigned consistently, sometimes it follows SAS naming convention (e.g. "Time of Month" would be Time_Of_Month), but othertimes it will import the variable as "Time of Month".
I'm aware of at least the Proc import code to force it to use sas naming convetion, but since this problem is fariyl recent, I'm thinking I must have changed some setting somewhere that switches the default since other people can run it and consistently get the variable to be assigned a sas name.
Thanks all for your help.
Options validvarname=V7;
My guess for changes would be in the config or autoexec files.
Options validvarname=V7;
My guess for changes would be in the config or autoexec files.
And if you don't have write access to the autoexec.sas or sasv9.cfg file, just put the options statement right before your proc import step. options validvarname is valid everywhere, not just on SAS invocation.
Proc Import and connection to an external DBMS do use different rules. It is very likely that your connection to an external DBMS will try to honor as much of the external DB as practical. So if the DB uses actual spaces in the variable names and your setting for VALIDVARNAME allows it, then you get those spaces.
Proc Import however is a much simpler process and I believe will force any resulting dataset to have the "standard" SAS variable name conventions by default.
Thanks for the responses, seems like options validvarname = V7 does the trick.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.