Hi Tom, I comparing my code with the code of another query which is working The code of query that is working %_eg_conditional_dropds(SASUSER.Query1_for_QUERY_FOR_HD_YTD); PROC SQL; CREATE TABLE SASUSER.Query1_for_QUERY_FOR_HD_YTD AS SELECT QUERY_FOR_HD_YTD.WOG_NAME, /* COUNT_OF_SER_ID */ (COUNT(QUERY_FOR_HD_YTD.SER_ID)) AS COUNT_OF_SER_ID FROM SASUSER.QUERY_FOR_HD_YTD AS QUERY_FOR_HD_YTD WHERE QUERY_FOR_HD_YTD.REG_CREATED BETWEEN "&MonthStartDate"dt AND "&MonthEndDate"dt GROUP BY QUERY_FOR_HD_YTD.WOG_NAME; QUIT; my code that is not working %_eg_conditional_dropds(SASUSER.QUERY_FOR_HD_YTD); PROC SQL; CREATE TABLE SASUSER.QUERY_FOR_HD_YTD AS SELECT sc.ser_id, sc.reg_created, YEAR(DATEPART(sc.reg_created)) AS YEAR, WG.WOG_NAME, sc.reg_created FROM ISPRD.ITSM_SERVICECALLS AS SC LEFT JOIN ISPRD.ITSM_CODES AS CD ON CD.COD_OID = SC.SER_CLO_OID INNER JOIN ISPRD.ITSM_CODES_LOCALE AS CL ON (CL.CDL_COD_OID = CD.COD_OID AND CL.CDL_LNG_OID = 1033) INNER JOIN ISPRD.ITSM_PER_CUSTOM_FIELDS AS PCF ON (ITSM_SERVICECALLS.SLC_SER_PER_OID = PCF.PEC_PER_OID) INNER JOIN ISPRD.ITSM_WORKGROUPS AS WG ON (PCF.PEC_WOG1_OID = WG.WOG_OID) /* entered by person primary workgroup */ WHERE SC.REG_CREATED BETWEEN "&MonthStartDate"dt AND "&MonthEndDate"dt AND CL.CDL_NAME NOT IN ("Duplicate","Withdrawn") AND WG.WOG_NAME = "Service Desk"; /* Only include the Service Desk from November 2009 */ /*AND WG.WOG_NAME IN ("CBS Desktop","Health Desktop Support", "Humanities Desktop", "S&E Desktop", "VC Desktop", "Service Desk", "CBS-Helpdesk","Health Helpdesk","Humanities Helpdesk","S&E Helpdesk","VC Helpdesk","VC IT Support"); */ QUIT; now in the first code that is working you can clearly deduct that I can compare &MonthStartDate with QUERY_FOR_HD_YTD.REG_CREATED. QUERY_FOR_HD_YTD is a table in SAS that is resulted from importing a data in sas. it is clear that &MonthStartDate is in the same data type of REG_CREATED. Now my question is Is there a way in SAS EG to cast my oracle variable into a compatible SAS Data type so i can use it and compare it with my SAS &MonthStartDate variable? Thank you very much in advance
... View more