« DWH optimization
Gender cleaning »


Locale names

Posted by Oleg Solovyev on Apr 26, 2011

Once at the interview they proposed me to show my programming skills on the production database. The interviewer rose from his table and asked me to write any code I want. I set down at his computer, opened the SAS window and wrote simple query that returns a list of all columns in the database:

proc sql;
  create table test as
  select *
  from dictionary.columns;
quit;

  “Well you rashly gave me access to your product DB and now I can get any information out of it.”
  “Hey, be careful!”
  “For instance I can get all the column names in your database.”
  “Hm… Nice!”

I was also impressed but not with the query.

  “Looks like some of your columns have Russian names.”
  “So what?”
  “I thought that SAS columns should contain English characters only.”
  “Well, seems this interview is not a waste of time for you. You’ve learned something new.”

This feature really impressed me. At SAS courses I learned that column names can contain only English letters, numbers or underscores. But Russian names didn’t fit this rule.

Later I forgot about this incident till once I had to import a lot of Excel files with Russian names. The IMPORT procedure converts Russian names into F1, F2, F3, … according to the order of names in an Excel file. But VALIDVARNAME option allows columns with Russian names for example:

options validvarname=any;
data work.test;
  'да - это русское имя'n = 1;
run;

One can also import Excel files with Russian names and use them in a code:

proc sql;
  select sum('да - это русское имя'n)
  from test;
quit;

Looks like SAS has its own double standards.

Leave a Reply

Please type the word if you are not a spam-robot