Help using Base SAS procedures

variable name with non-english letters?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

variable name with non-english letters?

Hello.

Jeg got a dataset with a variable containing the letter "ø" (a Danish letter) and probably due to this, an error appears every time I try to open/use the data including when I try to rename the variable name.

I been looking around and found something called "validvarname=any" but I'm not sure of how to use this option and whether this it the correct option.

Any help appreciated


Accepted Solutions
Solution
‎01-04-2012 08:16 AM
PROC Star
Posts: 7,363

variable name with non-english letters?

I would definitely try that first.  You can find its documentation at: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279245.htm

To use it, just specify the following before you run your code:

options validvarname=any;

View solution in original post


All Replies
Solution
‎01-04-2012 08:16 AM
PROC Star
Posts: 7,363

variable name with non-english letters?

I would definitely try that first.  You can find its documentation at: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279245.htm

To use it, just specify the following before you run your code:

options validvarname=any;

Valued Guide
Posts: 632

Re: variable name with non-english letters?

Just to followup on Art's reply.

If the character is in the data it should not be a problem - if it is in the data and it is giving you a problem then the following will not help - it is something else again.

Here is a silly example with ++ representing a Danish character which is not on my keyboard.  My suggestion is to rename as soon as possible.  Notice that the variable name with the special characters is quoted and followed immediately with a n.

option validvarname=any;
data withdanish;
   'ab++c'n = 5;
   run;

data coffeeonly;
   set withdanish(rename=('ab++c'n=abc));
   run;

Super User
Posts: 9,681

Re: variable name with non-english letters?

Hi. Arthur Carpenter .

Using proc datasets - a little tool managing datasets will save lots of time ,especiallly for a large table.

proc datasets library=work nolist;

modify withdanish;

rename 'ab++c'n=abc;

quit;

Happy New Year To you.

Happy to see you again at this forum.

Ksharp

Valued Guide
Posts: 632

Re: variable name with non-english letters?

Good point Ksharp.  If all you wanted to do was rename the variable, DATASETS would definately be a better way.  As you also show, the main point is the syntax for naming a variable with non-standard characters.

I have been busy writing my next book (on advanced techniques) which will be out in the spring.

Super User
Posts: 9,681

Re: variable name with non-english letters?

Hi. Arthur Carpenter.

What is the name of your new book?

I will take a look at it.

Best Regards!

Ksharp

Occasional Contributor
Posts: 14

Re: variable name with non-english letters?

Thanks everyone.

The option validvarname=any solved the problem, but next time when I have access to SAS again I'll try the renaming method.

Thanks again

☑ This topic is SOLVED.

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

Discussion stats
  • 6 replies
  • 347 views
  • 0 likes
  • 4 in conversation