I have several blocks of code that are similar that do not produce any errors, however the following block produces the error "Expression using equals (=) has components that are of different data types." I have checked the data types using proc contents and the data types are the same. Can someone help me with this?
proc sql;
create table work.dcn_missing as
select a.che_child_id as Child_ID,
a.che_child_firstname as Child_First_Name,
a.che_child_lastname as Child_Last_Name,
a.redcap_data_access_group as Agency,
a.che_dob as DOB,
a.che_enr_date as Child_Enrollment_Date,
coalesce(c.che_dcn,a.che_dcn) as DCN
from rdbs.child_enrollment as a
left join rdbs.verify_children as b on a.che_child_id = b.child_id
left join rdbs.bthlink as c on a.che_child_id = c.che_child_id
where current_status = 'Active' and (a.che_dcn = " " or a.che_dcn < '10000000' )
and a.che_child_id not in (select ID from ignore.'Ignore$'n where Sheet = DCN_Missing);
quit;
I have checked the data types using proc contents and the data types are the same. Can someone help me with this?
They're different.
Check every variable in your WHERE statement as well as check that the following is true based on your code below.
a.che_child_id not in (select ID from ignore.'Ignore$'n where Sheet = DCN_Missing);
@kempfz wrote:
I have several blocks of code that are similar that do not produce any errors, however the following block produces the error "Expression using equals (=) has components that are of different data types." I have checked the data types using proc contents and the data types are the same. Can someone help me with this?
proc sql; create table work.dcn_missing as select a.che_child_id as Child_ID, a.che_child_firstname as Child_First_Name, a.che_child_lastname as Child_Last_Name, a.redcap_data_access_group as Agency, a.che_dob as DOB, a.che_enr_date as Child_Enrollment_Date, coalesce(c.che_dcn,a.che_dcn) as DCN from rdbs.child_enrollment as a left join rdbs.verify_children as b on a.che_child_id = b.child_id left join rdbs.bthlink as c on a.che_child_id = c.che_child_id where current_status = 'Active' and (a.che_dcn = " " or a.che_dcn < '10000000' ) and a.che_child_id not in (select ID from ignore.'Ignore$'n where Sheet = DCN_Missing); quit;
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.