Skip to content
Advertisement

Problems with reserved field name ‘user’ in SAS Proc SQL

How do I select the user column from my table and not select the surprise ‘feature’ SAS added to their SQL syntax:

data have;
 user = 'huh??';
run;

proc sql ;
  select user from have;
quit;

Result:

rob

Bonus, the field name in the result table (if you create one) gets a temporary name… ie. something like _TEM001.

Advertisement

Answer

Use the name literal syntax, '<name>'n

select 'user'n from have;

Name literals in other systems, such as in pass through:

  • Oracle – double quoted. "user"
  • SQL Server – square bracketed [user]
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement