04-24-2015 11:20 AM
I have the following code and error message.
Create Table CR_Temp as
Input(YYYY,4.) As Year
,Vgroup||'A'||st||vtype||vdesc1||vdesc2||sens As ArtificialKey
,Input(CommodityCode,5.) As CommodityCode
,vtype||vdesc1||vdesc2 As GroupType
Where Year between '2007' and '2013' and MM = '00' and
vgroup = 'CR' and vdesc2 = 'VA' /* All Cash receipt values */
Order by Year,CommodityCode,FIPS;
ERROR: The following columns were not found in the contributing tables: Year.
Why doesn't the procedure accept "Year" following "As" and use it in the WHERE and Order by clauses? If I use "YYYY" following "As", it works.
04-24-2015 11:33 AM
I tried using Calculated Year in the WHERE and Order by clauses and got the error message and Note:
ERROR: Expression using IN has components that are of different data types.
NOTE: The IN referred to may have been transformed from an OR to an IN at some point during PROC SQL WHERE clause optimization.
04-24-2015 11:39 AM
Yes, I just figured that out. I converted YYYY to a numeric format and then used character values in the WHERE clause.
Thanks for the help!
Need further help from the community? Please ask a new question.