Does anyone see the error below? I do not see anything.
proc sql;
9251
9252 create table trans1 as
9253
9254 select itmCode_id as itemCode_id label="itemCode_id", itmCode as itemCode
9254! label="itemCode", itmDescr label="itemDesc",
9255 period as ioYear, sum(val) as proVal label="proVal"
9256 from sqltrn.dataView
9257 where period = 2012
9258 and datasetName = 'annual17'
9259 and schemaName = 'NAICS12'
9260 and valType in ('DOM','IMP','CTX')
9261 group by itmCode_id, itmCode, itmDescr, period
9262 order by itmCode_id
9263 ;
ERROR: Expression using equals (=) has components that are of different data types.
9264 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
Maxim 3: Know Your Data.
Run a proc contents on dataset sqltrn.dataView to determine the types of the variables used in your where condition.
My most suspected culprits:
Please let us know what proc contents has to say.
@Afor910327 wrote:
Does anyone see the error below? I do not see anything.
proc sql;
9251
9252 create table trans1 as
9253
9254 select itmCode_id as itemCode_id label="itemCode_id", itmCode as itemCode
9254! label="itemCode", itmDescr label="itemDesc",
9255 period as ioYear, sum(val) as proVal label="proVal"
9256 from sqltrn.dataView
9257 where period = 2012
9258 and datasetName = 'annual17'
9259 and schemaName = 'NAICS12'
9260 and valType in ('DOM','IMP','CTX')
9261 group by itmCode_id, itmCode, itmDescr, period
9262 order by itmCode_id
9263 ;
ERROR: Expression using equals (=) has components that are of different data types.
9264 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
ERROR: Expression using equals (=) has components that are of different data types.
This indicates one of your variables is not the right type given the testing in the WHERE clause.
period = 2012 means the variable period must be numeric (is it?)
datasetName = 'annual17' means that datasetName must be character (is it?)
same for SchemaName and ValType
Maxim 3: Know Your Data.
Run a proc contents on dataset sqltrn.dataView to determine the types of the variables used in your where condition.
My most suspected culprits:
Please let us know what proc contents has to say.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.