I recieved ERROR: Expression using equals (=) has components that are of different data types. When all my variables in the statement are NUMERIC. I ran PROC CONTENTS to double check. Here is my Code:
proc sql;
create table birth_temp_hum as
select*
from birth_temp hum1
where birth_temp.dateofbirth=hum1.strdate and birth_temp.V001=hum1.DHSCLUST
order by birth_temp.CASEID;
quit;Proc Contents results: From Hum1
| DHSCLUST | Num | 8 | BEST12. | BEST32. | |
| FID | Num | 8 | BEST12. | BEST32. | |
| MaxHum | Num | 8 | |||
| _NAME_ | Char | 11 | NAME OF FORMER VARIABLE | ||
| hm80 | Num | 8 | |||
| hm90 | Num | 8 | |||
| hm95 | Num | 8 | |||
| hm98 | Num | 8 | |||
| hum80perc | Num | 8 | BEST12. | BEST32. | |
| hum90perc | Num | 8 | BEST12. | BEST32. | |
| hum95perc | Num | 8 | BEST12. | BEST32. | |
| hum975perc | Num | 8 | BEST12. | BEST32. | |
| newstring | Char | 11 | |||
| strdate | Num | 8 | MMDDYY10. | ||
| tempdate | Char | 11 |
Proc Content Results from birth_temp
| V000 | Char | 3 | Country code and phase | ||
| V001 | Num | 4 | Cluster number | ||
| V002 | Num | 4 | Household number | ||
| V003 | Num | 3 | Respondent's line number | ||
| V004 | Num | 4 | Ultimate area unit | ||
| V005 | Num | 6 | Women's individual sample weight (6 decimals) | ||
| V012 | Num | 3 | Respondent's current age | ||
| V021 | Num | 4 | Primary sampling unit | ||
| V022 | Num | 3 | Sample strata for sampling errors | ||
| V023 | Num | 3 | Stratification used in sample design | ||
| V024 | Num | 3 | Region | ||
| V025 | Num | 3 | Type of place of residence | ||
| V133 | Num | 3 | Education in single years | ||
| V190 | Num | 3 | Wealth index combined | ||
| V191 | Num | 6 | Wealth index factor score combined (5 decimals) | ||
| V481 | Num | 3 | Covered by health insurance | ||
| V501 | Num | 3 | Current marital status | ||
| date | Num | 8 | DATE9. | ||
| dateofbirth | Num | 8 | MMDDYY10. | ||
| day | Num | 8 | |||
| hw80 | Num | 8 | |||
| hw90 | Num | 8 | |||
| hw95 | Num | 8 | |||
| hw98 | Num | 8 | |||
| strdate | Char | 11 | |||
| temp80perc | Num | 8 | BEST12. | BEST32. | |
| temp90perc | Num | 8 | BEST12. | BEST32. | |
| temp95perc | Num | 8 | BEST12. | BEST32. | |
| temp975perc | Num | 8 | BEST12. | BEST32. | |
| tempdate | Num | 8 | |||
| year | Num | 8 |
@smcelroy wrote:
I recieved ERROR: Expression using equals (=) has components that are of different data types. When all my variables in the statement are NUMERIC. I ran PROC CONTENTS to double check. Here is my Code:
proc sql; create table birth_temp_hum as select* from birth_temp hum1 where birth_temp.dateofbirth=hum1.strdate and birth_temp.V001=hum1.DHSCLUST order by birth_temp.CASEID; quit;
Your SQL FROM clause is essentially the problem here, not the where clause. It should say:
from birth_temp,hum1
with a comma between birth_temp and hum1.
@smcelroy wrote:
I recieved ERROR: Expression using equals (=) has components that are of different data types. When all my variables in the statement are NUMERIC. I ran PROC CONTENTS to double check. Here is my Code:
proc sql; create table birth_temp_hum as select* from birth_temp hum1 where birth_temp.dateofbirth=hum1.strdate and birth_temp.V001=hum1.DHSCLUST order by birth_temp.CASEID; quit;
Your SQL FROM clause is essentially the problem here, not the where clause. It should say:
from birth_temp,hum1
with a comma between birth_temp and hum1.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.