Help using Base SAS procedures

error: Variable x has been defined as both character and numeric.

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

error: Variable x has been defined as both character and numeric.

Hi,

After combining my data I got some errors such as

data combined;

68     merge study4s study4s2;

ERROR: Variable gender has been defined as both character and numeric.

ERROR: Variable english has been defined as both character and numeric.

ERROR: Variable describejeans_1__Description_of_ has been defined as both character and numeric.

I heard that SAS doesn't read blanks so I filled all the blanks with 999 in excel before importing here. That's the reason why I am getting those errors but I don't know how to fix it. Any suggestions?

Thanks,

Sara


Accepted Solutions
Solution
‎10-09-2013 04:29 PM
Super Contributor
Posts: 418

Re: error: Variable x has been defined as both character and numeric.

You're quite welcome! and perhaps the professors example was meant to show you this fact about merging in sas.

If you like, you can specify what OUtput dataset you want (which columns do you want, do you want the variables Gender and Gender1 from datasets A and B to be distinct? if so a rename statement would be helpful!).

Let me know what you are trying to do and I can help you write it / explain it. However I think some time spent looking up the fundamental rules for sas merging would be helpful!

Good luck.

View solution in original post


All Replies
Super Contributor
Posts: 418

Re: error: Variable x has been defined as both character and numeric.

Hey! You started a new thread, it's much better for you to place this in your previous thread so people can read through and help you better!

basically the errors you are getting are exactly what you are seeing. The values of "gender" and "english" are character in one dataset and Numeric in another, this cannot happen in a merge statement because of the way that SAS merges things.

For clarification, do you happen to know the rules of SAS and merging? Aka are you aware that if variables have the same name in two distinct datasets they will actually be over-written instead of outputting two columns with the same name?

Brandon

New Contributor
Posts: 4

Re: error: Variable x has been defined as both character and numeric.

I didn't know that. This is the first time I am trying to write something and it doesn't go smoothly but I am trying to learn by myself. I have to ask this issue to my professor I guess because I don't know how to fix it myself.

P.S: I posted it to the previous thread as well.

Thanks so much.

Solution
‎10-09-2013 04:29 PM
Super Contributor
Posts: 418

Re: error: Variable x has been defined as both character and numeric.

You're quite welcome! and perhaps the professors example was meant to show you this fact about merging in sas.

If you like, you can specify what OUtput dataset you want (which columns do you want, do you want the variables Gender and Gender1 from datasets A and B to be distinct? if so a rename statement would be helpful!).

Let me know what you are trying to do and I can help you write it / explain it. However I think some time spent looking up the fundamental rules for sas merging would be helpful!

Good luck.

☑ This topic is SOLVED.

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

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