SAS Proc Import variable name

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

SAS Proc Import variable name

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.


Accepted Solutions
Solution
‎02-14-2017 06:02 PM
Grand Advisor
Posts: 17,360

Re: SAS Proc Import variable name

Options validvarname=V7;

 

My guess for changes would be in the config or autoexec files.

View solution in original post


All Replies
Solution
‎02-14-2017 06:02 PM
Grand Advisor
Posts: 17,360

Re: SAS Proc Import variable name

Options validvarname=V7;

 

My guess for changes would be in the config or autoexec files.

Esteemed Advisor
Posts: 6,669

Re: SAS Proc Import variable name

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Grand Advisor
Posts: 10,211

Re: SAS Proc Import variable name

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.

New Contributor
Posts: 2

Re: SAS Proc Import variable name

Thanks for the responses, seems like options validvarname = V7 does the trick.

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 113 views
  • 0 likes
  • 4 in conversation