I would like to merge two datasets called report.FY08_datanodup and report.melig. The problem is that they are not in the same format. I attempted to correct the melig file for PAT_MAR to be numeric instead of character. it isn't working, please help. Thanks.
newmar = 1*PAT_MAR;
proc sort data = report.FY08_datanodup;
Thanks for your help. I am attempting to merge two files report.Fiscal08_datanodup and report.melig, but the variable PAT_MAR is numeric in one and character in the latter file.
Anyway I attempted to do the following, but the log said
48 merge one report.melig;
ERROR: Variable PAT_MAR has been defined as both character and numeric.
49 by PAT_ID;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set REPORT.SIX may be incomplete. When this step was stopped there were 0
observations and 91 variables.
WARNING: Data set REPORT.SIX was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.00 seconds
x = put(num_var, $10.);
proc sort data = one;
proc sort data = report.melig;
merge one report.melig;
Your SAS variables listed in the BY statement must be of a consistent type, either NUMERIC or CHARACTER, and each of your input file specified on the MERGE statement must be sorted in the same sequence as listed in the BY list (in a typical scenario). Since you cannot have one variable with two different types, you are faced with doing a variable DROP and a RENAME process, so that you get back to having your BY variables all having the appropriate name.
So, one technical is to do the RENAME= on the SET for the file you want to modify, and then assign the same-named BY variable with the necessary ATTRIB (or LENGTH) attributes and derivation code, such as the INPUT function. After performing you data manipulation, verify the SAS variable results in each of your to-be-merged files using SAS PROC CONTENTS.
Once you have confirmed the SAS variable attributes are consistent, then move forward with your DATA step MERGE process.
The SAS support website http://support.sas.com/ hosts SAS product documentation and also additional user community (SGF and SUGI) technical papers as well as SAS-contributed technotes.
For example, I did a Google advanced search against the SAS.COM site - here is the argument entered:
data step merge processing site:sas.com
A SEARCH facility is also provided at the SAS support website, in addition to the Google example.