Hello All
I am trying to append two datasets and i am having an error saying XY variables has been defined as both charcter and numeric. The values are all numeric and some missing like blanks and dots but i want to be numeric.Kindly help, please see the code below with the error message :-
Data abc;
set sourc.data1 sourc.data2;
Result=input(XY ,best.);
run;
ERROR: Variable XY has been defined as both character and numeric.
WARNING: Variable Result has already been defined as numeric.
The error message pretty much says it all. Please run this
proc contents data=sourc.data1;
run;
proc contents data=sourc.data2;
run;
and see the variables section. Then convert the XY variable in one of the data sets accordingly.
@GeetVish , please let me know if this solved your problem or you need further assistance. Remember that the INPUT Function requires a character argument 🙂
Please be more specific about what you did and what your data looks like. Did you convert a variable? And what does your log say now?
Sorry i am working and messaging thats why its short.
So i found which data set has character variables and i am converting that into numeric. I have the variable values as yes , No, slight, exactly and many numbers . When i did the input(XY, best.) i am getting the new variable as just dots.
Can you show me some of your data? Please run
proc print data=sourc.data1;
run;
and post the result..
Please see below
So that is your XY variable or? It is clearly a character variable. It makes no sense to represent these values as numbers.
I may misunderstand you requirement entirely. However, please be more specific if you want a usable code answer.
First of all, I can barely see any of your data in the attached file.
But let's take a value that I actually can see. You have a character value of "value=60-177". What do you want the numerical representation of that value to be? The data seems very unstructured and you can not simply represent the variable XY as numbers.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.