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

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

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

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

6 REPLIES 6
art297
Opal | Level 21

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;

ArtC
Rhodochrosite | Level 12

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;

Ksharp
Super User

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

ArtC
Rhodochrosite | Level 12

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.

Ksharp
Super User

Hi. Arthur Carpenter.

What is the name of your new book?

I will take a look at it.

Best Regards!

Ksharp

Dan_yu_W
Obsidian | Level 7

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

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 6 replies
  • 2643 views
  • 0 likes
  • 4 in conversation