ERROR: Expression using equals (=) has components that are of different data types.

Reply
Occasional Contributor
Posts: 8

ERROR: Expression using equals (=) has components that are of different data types.

create table tempsas.employment as

6939

6940 select cm.code_id as indCode_id, cm.code as indCode, cm.descr as indDescr, ed.period, ed.value as employment

6941 from dbo.def_dataView ed

6942 join tempsas.indCode_List cm

6943 on ed.code_id = cm.code_id

6944 where ed.period = "&ioyear"

WARNING: Apparent symbolic reference IOYEAR not resolved.

6945 and ed.datasetName = &dsName

SYMBOLGEN: Macro variable DSNAME resolves to 'Annual15'

6946 and upcase(ed.classCode) = 'FTPT'

6947 and upcase(ed.typeCode) = 'EMP'

6948 order by cm.code

6949 ;

ERROR: Expression using equals (=) has components that are of different data types.

6950

6951 create table tempsas.ind_comp as

6952

6953 select indCode, sum(val) as compensation

6954 from trn.dataView

6955 where period = "&ioyear"

WARNING: Apparent symbolic reference IOYEAR not resolved.

6956 and upcase(substr(itmCode,1,1)) in ('W')

6957 and datasetName = &dsName

SYMBOLGEN: Macro variable DSNAME resolves to 'Annual15'

6958 group by indCode

6959 order by indcode

6960 ;

 

Could anyone please help me out with this error? I cannot understand what I have to change...

Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: ERROR: Expression using equals (=) has components that are of different data types.

This error seems to be very clear to me:

ERROR: Expression using equals (=) has components that are of different data types.

Somewhere above that row you have a check where one side of the equals type (character/numeric) does not equal the other side, for example:
"This string" = 99

Would not work as the left is a string and the right is a number.

I would suspect that this row:

6944 where ed.period = "&ioyear"

Is the culprit as the warning:

WARNING: Apparent symbolic reference IOYEAR not resolved.

Tells you the macro variable IOYEAR does not exist.

 

Perhaps your missing a %let ioyear=2017; or something before that code?

Occasional Contributor
Posts: 8

Re: ERROR: Expression using equals (=) has components that are of different data types.

Hi RW9,

 

Thanks for the response, I do not think that I missed any %letioyear=2015 (my rear of revision).

 

This is the part of the code, I keep changing things around and no output gets succesfully created...

 

proc sql;

connect to odbc as iips

(datasrc="IIPS");

*************************************************************;

create table tempsas.indCode_List as

select * from connection to iips

(

select *

from cde.getCodes('io','ind','NAICS07')

order by code

)

;

**********************************************************************************************;

 

create table tempsas.employment as

select cm.code_id as indCode_id, cm.code as indCode, cm.descr as indDescr, ed.period, ed.value as employment

from dbo.def_dataView ed

join tempsas.indCode_List cm

on ed.code_id = cm.code_id

where ed.period = "&ioyear"

and ed.datasetName = &dsName

and upcase(ed.classCode) = 'FTPT'

and upcase(ed.typeCode) = 'EMP'

order by cm.code

;

create table tempsas.ind_comp as

select indCode, sum(val) as compensation

from trn.dataView

where period = "&ioyear"

and upcase(substr(itmCode,1,1)) in ('W')

and datasetName = &dsName

group by indCode

order by indcode

;

quit;

proc sort data=tempsas.ind_conc out=tempsas.ind_conc_xIndCode;

by indCode indCodeDescr;

data tempsas.emp_comp_conc;

merge tempsas.employment(in=a) tempsas.ind_comp(in=b) tempsas.ind_conc_xIndCode;

by indCode;

if a=1 and b=1;

proc sort data=tempsas.emp_comp_conc out=tempsas.emp_comp_conc_sort;

by indACPSA indACPSADescr;

proc summary data=tempsas.emp_comp_conc_sort;

by indACPSA;

id indACPSADescr;

var employment compensation;

output out=tempsas.emp_comp_summary(drop=_type_ _freq_) sum= ;

data tempsas.emp_conc_ratio_0;

merge tempsas.emp_comp_summary tempsas.indACPSA_ratio_sort;

by indACPSA;

empACPSA = employment * indACPSA_ratio;

compACPSA = compensation * indACPSA_ratio;

run;

proc summary data=tempsas.emp_conc_ratio_0;

var employment compensation indACPSA_ratio empACPSA compACPSA;

output out=tempsas.emp_conc_ratio_sum_0(drop=_type_ _freq_) sum= ;

run;

 

Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: ERROR: Expression using equals (=) has components that are of different data types.

I don't know what to say further.  The warning is very clear:

WARNING: Apparent symbolic reference IOYEAR not resolved.

 

The macro variable IOYEAR has not been defined - i.e. nowhere in your code - either the code you posted (please feel feel to point out where it is created as I can't see it), nor in any of your code do you have a section which either looks like:

%let IOYEAR=...;

Which is how you define macro variables, or by using proc sql into clause.  None of this appears in your code.  

 

Now for the seoncd part.  As per my previous post, one of the equals conditions from:

---

6943 on ed.code_id = cm.code_id

6944 where ed.period = "&ioyear"

WARNING: Apparent symbolic reference IOYEAR not resolved.

6945 and ed.datasetName = &dsName

SYMBOLGEN: Macro variable DSNAME resolves to 'Annual15'

6946 and upcase(ed.classCode) = 'FTPT'

6947 and upcase(ed.typeCode) = 'EMP'

---

Has either:

<numeric>=<character>

or 

<character>=<numeric>

I am not a mind reader here, I cannot see your computer, you will need to check each of these, you cant compare one datatype to another without converting.  If you followed the guidance on how to post a good question, you would have started by posting test data in the form of a datastep, what the output should look like and your code - then I would be able to tell you which variable exactly it is that doesn't match.

Ask a Question
Discussion stats
  • 3 replies
  • 117 views
  • 1 like
  • 2 in conversation