BookmarkSubscribeRSS Feed
Afor910327
Obsidian | Level 7

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...

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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?

Afor910327
Obsidian | Level 7

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;

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1172 views
  • 1 like
  • 2 in conversation