BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sarab
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Anotherdream
Quartz | Level 8

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

3 REPLIES 3
Anotherdream
Quartz | Level 8

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

sarab
Calcite | Level 5

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.

Anotherdream
Quartz | Level 8

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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