Help using Base SAS procedures

unusual variable name when assigning columns in sql

Reply
Contributor
Posts: 74

unusual variable name when assigning columns in sql

I was running a sql

input table EMP is like the following:
id name sal
1 ram 300

My sql:
proc sql;
create table aa as select id,name=name,sal from emp;
quit;

In output table
id _TEMA001 sal
1 1 300

the variable _TEMA001 is numeric and has value 1 ,any one has any idea why this unusual name is appearing and why it is numeric?

Please help.
Super Contributor
Posts: 345

Re: unusual variable name when assigning columns in sql

Can you explain what you want to achieve by using "name=name"?
Super Contributor
Super Contributor
Posts: 3,174

Re: unusual variable name when assigning columns in sql

Posted in reply to andreas_lds
Share your entire SAS program code, in the context of the SAS execution log. A PROC CONTENTS output *AFTER* the PROC SQL would also be useful.

Scott Barry
SBBWorks, Inc.
Trusted Advisor
Posts: 2,116

Re: unusual variable name when assigning columns in sql

Read the documentation for the SELECT statement. "name=name" is a logical expression and returns a 1 or 0. Since you didn't give it a name, SAS made up one for you.

If you were just trying to rename the variable "name", use the AS operator.
Ask a Question
Discussion stats
  • 3 replies
  • 117 views
  • 0 likes
  • 4 in conversation