BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Misekato
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Options validvarname=V7;

 

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

View solution in original post

4 REPLIES 4
Reeza
Super User

Options validvarname=V7;

 

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

Kurt_Bremser
Super User

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.

ballardw
Super User

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.

Misekato
Calcite | Level 5

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

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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