DATA Step, Macro, Functions and more

sear variable starting for "_" in different tables with proc sql

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 127
Accepted Solution

sear variable starting for "_" in different tables with proc sql

Dear experts,

I was searching a variable starting with "_", eg _xxxx in one excel table.

Now I am performing a join and I am looking the same variable specyfind the table, e.g. t1._xxxx

but I got the following message: column _xxxx could not be found.

Any idea to solve it? Thanks a lot.

 


Accepted Solutions
Solution
‎05-11-2016 04:38 AM
Super User
Posts: 11,343

Re: sear variable starting for "_" in different tables with proc sql

Posted in reply to Sir_Highbury

Run Proc Contents on BOTH tables to get descriptions of the data. Find the correct name and use that OR rename the variable to match (recommended) in both tables.

 

Since it appears that your data originated in Excel the issue likely starts with the data and how it was brought into SAS. If one person created a sheet and had a space or other non-digit non-letter character at the start of a column name and someone else didn't in another sheet then the variables could very well end up with different SAS variable names. If one differs then you might find that others do as well and possibly the type, numeric/character changes.

View solution in original post


All Replies
Solution
‎05-11-2016 04:38 AM
Super User
Posts: 11,343

Re: sear variable starting for "_" in different tables with proc sql

Posted in reply to Sir_Highbury

Run Proc Contents on BOTH tables to get descriptions of the data. Find the correct name and use that OR rename the variable to match (recommended) in both tables.

 

Since it appears that your data originated in Excel the issue likely starts with the data and how it was brought into SAS. If one person created a sheet and had a space or other non-digit non-letter character at the start of a column name and someone else didn't in another sheet then the variables could very well end up with different SAS variable names. If one differs then you might find that others do as well and possibly the type, numeric/character changes.

☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 174 views
  • 2 likes
  • 2 in conversation