Help using Base SAS procedures

Merge tables having the same variables of different data types.

Reply
N/A
Posts: 0

Merge tables having the same variables of different data types.

I need to merge two tables. Here's the situation :

The base table CTS.A (has numeric variable called var)
Table which needs to be merged : CTS.B (has a character variable called var, it has both number and character values)

when i merge now, the merged data set contains null values for var from CTS.B

I want the merged data set to contain number values of var from CTS.B. The character values can eat shit and die.

Is there an easy way to do this?? without going back to modify CTS.B ??

-mosas
Super Contributor
Super Contributor
Posts: 3,174

Re: Merge tables having the same variables of different data types.

Posted in reply to deleted_user
Suggest you lose the subjective commentary and limit your posts to pertinent / relevant discussion.

So you can use the ANYALPHA function to filter our your character variable input from CTS.B, in either a prior DATA step or a nested query (if using PROC SQL).

And, also, you will need to use the SAS INPUT function to convert the CHARACTER variable to a SAS NUMERIC type variable in order to work with either a MERGE in a DATA step or a PROC SQL JOIN.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search arguments, this topic/post:
convert character variable numeric site:sas.com

proc sql join merge files site:sas.com
N/A
Posts: 0

Re: Merge tables having the same variables of different data types.

Thank you Scott!
Ask a Question
Discussion stats
  • 2 replies
  • 91 views
  • 0 likes
  • 2 in conversation