BookmarkSubscribeRSS Feed
archita
Fluorite | Level 6
I have a dataset after merging two datasets ..having common varianle id , though I'd is numeric in both .. after running the merge statement , it is giving error saying variable defined as both character and numeric. I also used put function to convert the variable .. after that too giving the same results. How should I go about ?
2 REPLIES 2
ballardw
Super User

Just because values contain digits does not mean that your variable is numeric.

 

If you use Proc Import or one of the widgets to read an external file then decisions as to what type of variable are based on the content of a very few rows of data. If in one file there happens to be text such as "unknown" in the data column then you may end up with character variables.

 

Run Proc Contents on both of the data sets used on the merge. I bet you will find that one version of the variable is numeric and the other is character.

 

When you encounter errors and want to ask about them best practice is to copy the entire code of a procedure or data step with all the notes, warnings and errors from the LOG and paste into a code box opened on the forum with the </>. The code box is important to preserve formatting of the text to preserve the position of the diagnostic characters that SAS often places in the log.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 458 views
  • 0 likes
  • 3 in conversation