<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: comparing varchar in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102091#M28646</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like you are trying to use character strings to specify datetime constants.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE SC.REG_CREATED BETWEEN "&amp;amp;MonthStartDate" AND "&amp;amp;MonthEndDate"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe that Oracle only has DATETIME variables, it does not have DATE or TIME variables so you should code this as something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE SC.REG_CREATED BETWEEN "&amp;amp;MonthStartDate:00:00"dt AND "&amp;amp;MonthEndDate:00:00"dt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Where the macro variables have values in DATE9 format.&amp;nbsp; 01JAN2010 for example. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 May 2012 05:34:54 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2012-05-03T05:34:54Z</dc:date>
    <item>
      <title>comparing varchar</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102090#M28645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%_eg_conditional_dropds(SASUSER.QUERY_FOR_HD_YTD);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CREATE TABLE SASUSER.QUERY_FOR_HD_YTD AS &lt;/P&gt;&lt;P&gt;SELECT sc.ser_id, &lt;/P&gt;&lt;P&gt;&amp;nbsp; sc.reg_created, &lt;/P&gt;&lt;P&gt;&amp;nbsp; YEAR(DATEPART(sc.reg_created)) AS YEAR,&lt;/P&gt;&lt;P&gt;&amp;nbsp; WG.WOG_NAME&lt;/P&gt;&lt;P&gt;FROM ISPRD.ITSM_SERVICECALLS AS SC LEFT JOIN ISPRD.ITSM_CODES AS CD ON CD.COD_OID = SC.SER_CLO_OID&lt;/P&gt;&lt;P&gt;&amp;nbsp; INNER JOIN ISPRD.ITSM_CODES_LOCALE AS CL ON (CL.CDL_COD_OID = CD.COD_OID AND CL.CDL_LNG_OID = 1033)&lt;/P&gt;&lt;P&gt;&amp;nbsp; INNER JOIN ISPRD.ITSM_PER_CUSTOM_FIELDS AS PCF ON (ITSM_SERVICECALLS.SLC_SER_PER_OID = PCF.PEC_PER_OID)&lt;/P&gt;&lt;P&gt;&amp;nbsp; INNER JOIN ISPRD.ITSM_WORKGROUPS AS WG ON (PCF.PEC_WOG1_OID = WG.WOG_OID) /* entered by person primary workgroup */&lt;/P&gt;&lt;P&gt;WHERE SC.REG_CREATED BETWEEN "&amp;amp;MonthStartDate" AND "&amp;amp;MonthEndDate"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND CL.CDL_NAME NOT IN ("Duplicate","Withdrawn")&lt;/P&gt;&lt;P&gt;AND WG.WOG_NAME = "Service Desk"; &lt;/P&gt;&lt;P&gt;/* Only include the Service Desk from November 2009 */&lt;/P&gt;&lt;P&gt;/*AND WG.WOG_NAME IN ("CBS Desktop","Health Desktop Support", "Humanities Desktop", "S&amp;amp;E Desktop", "VC Desktop", "Service Desk",&lt;/P&gt;&lt;P&gt;&amp;nbsp; "CBS-Helpdesk","Health Helpdesk","Humanities Helpdesk","S&amp;amp;E Helpdesk","VC Helpdesk","VC IT Support"); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whenever i tried to run it sas eg 4.1 gives me error: expession using equals (=) has components that are of different data types when eg try to analyse the line AND WG.WOG_NAME = "Service Desk"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i check on the database end and the data type for WOG_NAME is varchar2 (ORACLE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how do i compare this WOG_NAME that has a value of "Service Desk"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 05:26:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102090#M28645</guid>
      <dc:creator>sugita</dc:creator>
      <dc:date>2012-05-03T05:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: comparing varchar</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102091#M28646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like you are trying to use character strings to specify datetime constants.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE SC.REG_CREATED BETWEEN "&amp;amp;MonthStartDate" AND "&amp;amp;MonthEndDate"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe that Oracle only has DATETIME variables, it does not have DATE or TIME variables so you should code this as something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE SC.REG_CREATED BETWEEN "&amp;amp;MonthStartDate:00:00"dt AND "&amp;amp;MonthEndDate:00:00"dt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Where the macro variables have values in DATE9 format.&amp;nbsp; 01JAN2010 for example. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 05:34:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102091#M28646</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-05-03T05:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: comparing varchar</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102092#M28647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply. I tried to change it and it gives me ERROR: Invalid date/time/datetime constant "&amp;amp;MonthStartDate:00:00"dt. I want to ask you what is the dt stand for?&lt;/P&gt;&lt;P&gt;I also believe that the macro variable value is in&amp;nbsp; DATE9 format like January 01, 2006 12:00:00 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 06:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102092#M28647</guid>
      <dc:creator>sugita</dc:creator>
      <dc:date>2012-05-03T06:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: comparing varchar</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102093#M28648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, I just double check the type of my macro variables and apparently its timestamp.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 06:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102093#M28648</guid>
      <dc:creator>sugita</dc:creator>
      <dc:date>2012-05-03T06:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: comparing varchar</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102094#M28649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS would treat "&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;January 01, 2006 12:00:00 AM" the same as any other character string.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The proper way to express that as a SAS datetime literal&lt;/SPAN&gt; would be "01JAN2006:00:00"dt.&lt;/P&gt;&lt;P&gt;That is why it was invalid when you added the DT suffix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The dt stands for DateTime.&amp;nbsp; SAS has a number of literals that are specified by quoted strings with letter suffixes.&lt;/P&gt;&lt;P&gt;'01JAN2006'd&amp;nbsp; would be a date literal.&lt;/P&gt;&lt;P&gt;'01:30't would be a time liternal.&lt;/P&gt;&lt;P&gt;'3031'x would be a hexadecimal representation of a the string '01'.&lt;/P&gt;&lt;P&gt;'0101'b would be the number 5 as a binary literal.&lt;/P&gt;&lt;P&gt;'Strange Variable Name'n would be a name literal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 06:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102094#M28649</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-05-03T06:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: comparing varchar</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102095#M28650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to compare &lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;WHERE&lt;/TD&gt;&lt;TD&gt;SC.REG_CREATED BETWEEN '01NOV2007:00:00:00'dt AND '30NOV2007:23:59:59'dt&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and it works. it produce the output. So it is obvious that the data type of SC.REG_CREATED and &amp;amp;MonthStartDate is not the same. &lt;/P&gt;&lt;P&gt;how do i cast &amp;amp;MonthStartDate to the same data type as SC.REG_CREATED so i can compare these two variable? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS. MonthStartDate is a variable that is entered by the end user and it has format of November 01, 2007 00:00:00 AM&lt;/P&gt;&lt;P&gt;%_eg_conditional_dropds(SASUSER.QUERY_FOR_HD_YTD);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CREATE TABLE SASUSER.QUERY_FOR_HD_YTD AS &lt;/P&gt;&lt;P&gt;SELECT sc.ser_id, &lt;/P&gt;&lt;P&gt;&amp;nbsp; sc.reg_created, &lt;/P&gt;&lt;P&gt;&amp;nbsp; YEAR(DATEPART(sc.reg_created)) AS YEAR,&lt;/P&gt;&lt;P&gt;&amp;nbsp; WG.WOG_NAME&lt;/P&gt;&lt;P&gt;FROM ISPRD.ITSM_SERVICECALLS AS SC LEFT JOIN ISPRD.ITSM_CODES AS CD ON CD.COD_OID = SC.SER_CLO_OID&lt;/P&gt;&lt;P&gt;&amp;nbsp; INNER JOIN ISPRD.ITSM_CODES_LOCALE AS CL ON (CL.CDL_COD_OID = CD.COD_OID AND CL.CDL_LNG_OID = 1033)&lt;/P&gt;&lt;P&gt;&amp;nbsp; INNER JOIN ISPRD.ITSM_PER_CUSTOM_FIELDS AS PCF ON (ITSM_SERVICECALLS.SLC_SER_PER_OID = PCF.PEC_PER_OID)&lt;/P&gt;&lt;P&gt;&amp;nbsp; INNER JOIN ISPRD.ITSM_WORKGROUPS AS WG ON (PCF.PEC_WOG1_OID = WG.WOG_OID) /* entered by person primary workgroup */&lt;/P&gt;&lt;P&gt;WHERE SC.REG_CREATED BETWEEN '01NOV2007:00:00:00'dt AND '30NOV2007:23:59:59'dt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND CL.CDL_NAME NOT IN ("Duplicate","Withdrawn")&lt;/P&gt;&lt;P&gt;AND WG.WOG_NAME = "Service Desk"; &lt;/P&gt;&lt;P&gt;/* Only include the Service Desk from November 2009 */&lt;/P&gt;&lt;P&gt;/*AND WG.WOG_NAME IN ("CBS Desktop","Health Desktop Support", "Humanities Desktop", "S&amp;amp;E Desktop", "VC Desktop", "Service Desk",&lt;/P&gt;&lt;P&gt;&amp;nbsp; "CBS-Helpdesk","Health Helpdesk","Humanities Helpdesk","S&amp;amp;E Helpdesk","VC Helpdesk","VC IT Support"); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 06:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102095#M28650</guid>
      <dc:creator>sugita</dc:creator>
      <dc:date>2012-05-03T06:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: comparing varchar</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102096#M28651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How does the end user enter it?&amp;nbsp; &lt;/P&gt;&lt;P&gt;If it is just a text field then teach them to enter it in a format that SAS can handle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can't then you will need to parse the "timestamp" format that you are using into something that SAS can understand.&lt;/P&gt;&lt;P&gt;I do not know of any SAS informat that can read that text string with the month spelled out and the time like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not that hard to convert to DATE9. format by processing the string.&lt;/P&gt;&lt;P&gt;I will use DT1 and DT2 as the macro variable names as that is about 10,000 times easier to type than MonthStartDate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let dt1=November 01, 2007 12:00:00 AM;&lt;/P&gt;&lt;P&gt;%let dt1=%quote(&amp;amp;dt1);&lt;/P&gt;&lt;P&gt;%let dt1=%scan(&amp;amp;dt1,2)%substr(&amp;amp;dt1,1,3)%scan(&amp;amp;dt1,3);&lt;/P&gt;&lt;P&gt;%let dt2=November 30, 2007 12:00:00 AM;&lt;/P&gt;&lt;P&gt;%let dt2=%quote(&amp;amp;dt2);&lt;/P&gt;&lt;P&gt;%let dt2=%scan(&amp;amp;dt2,2)%substr(&amp;amp;dt2,1,3)%scan(&amp;amp;dt2,3);&lt;/P&gt;&lt;P&gt;%put dt1=&amp;amp;dt1 dt2=&amp;amp;dt2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can use them in your WHERE clause.&amp;nbsp; (Make sure to use double quote characters so the macro variable can expand.)&lt;/P&gt;&lt;P&gt;.... WHERE ... BETWEEN "&amp;amp;dt1:00:00"dt AND "&amp;amp;dt2:23:59:59"dt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 07:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102096#M28651</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-05-03T07:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: comparing varchar</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102097#M28652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I comparing my code with the code of another query which is working&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code of query that is working&lt;/P&gt;&lt;P&gt;%_eg_conditional_dropds(SASUSER.Query1_for_QUERY_FOR_HD_YTD);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; CREATE TABLE SASUSER.Query1_for_QUERY_FOR_HD_YTD AS &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SELECT QUERY_FOR_HD_YTD.WOG_NAME, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* COUNT_OF_SER_ID */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (COUNT(QUERY_FOR_HD_YTD.SER_ID)) AS COUNT_OF_SER_ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM SASUSER.QUERY_FOR_HD_YTD AS QUERY_FOR_HD_YTD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE &lt;STRONG&gt;QUERY_FOR_HD_YTD.REG_CREATED BETWEEN "&amp;amp;MonthStartDate"dt AND "&amp;amp;MonthEndDate"dt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GROUP BY QUERY_FOR_HD_YTD.WOG_NAME;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my code that is not working&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%_eg_conditional_dropds(SASUSER.QUERY_FOR_HD_YTD);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CREATE TABLE SASUSER.QUERY_FOR_HD_YTD AS &lt;/P&gt;&lt;P&gt;SELECT sc.ser_id, &lt;/P&gt;&lt;P&gt;&amp;nbsp; sc.reg_created, &lt;/P&gt;&lt;P&gt;&amp;nbsp; YEAR(DATEPART(sc.reg_created)) AS YEAR,&lt;/P&gt;&lt;P&gt;&amp;nbsp; WG.WOG_NAME,&lt;/P&gt;&lt;P&gt;&amp;nbsp; sc.reg_created&lt;/P&gt;&lt;P&gt;FROM ISPRD.ITSM_SERVICECALLS AS SC LEFT JOIN ISPRD.ITSM_CODES AS CD ON CD.COD_OID = SC.SER_CLO_OID&lt;/P&gt;&lt;P&gt;&amp;nbsp; INNER JOIN ISPRD.ITSM_CODES_LOCALE AS CL ON (CL.CDL_COD_OID = CD.COD_OID AND CL.CDL_LNG_OID = 1033)&lt;/P&gt;&lt;P&gt;&amp;nbsp; INNER JOIN ISPRD.ITSM_PER_CUSTOM_FIELDS AS PCF ON (ITSM_SERVICECALLS.SLC_SER_PER_OID = PCF.PEC_PER_OID)&lt;/P&gt;&lt;P&gt;&amp;nbsp; INNER JOIN ISPRD.ITSM_WORKGROUPS AS WG ON (PCF.PEC_WOG1_OID = WG.WOG_OID) /* entered by person primary workgroup */&lt;/P&gt;&lt;P&gt;WHERE &lt;STRONG&gt;SC.REG_CREATED BETWEEN "&amp;amp;MonthStartDate"dt AND "&amp;amp;MonthEndDate"dt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND CL.CDL_NAME NOT IN ("Duplicate","Withdrawn")&lt;/P&gt;&lt;P&gt;AND WG.WOG_NAME = "Service Desk"; &lt;/P&gt;&lt;P&gt;/* Only include the Service Desk from November 2009 */&lt;/P&gt;&lt;P&gt;/*AND WG.WOG_NAME IN ("CBS Desktop","Health Desktop Support", "Humanities Desktop", "S&amp;amp;E Desktop", "VC Desktop", "Service Desk",&lt;/P&gt;&lt;P&gt;&amp;nbsp; "CBS-Helpdesk","Health Helpdesk","Humanities Helpdesk","S&amp;amp;E Helpdesk","VC Helpdesk","VC IT Support"); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now in the first code that is working you can clearly deduct that I can compare &amp;amp;MonthStartDate with &lt;STRONG&gt;QUERY_FOR_HD_YTD.REG_CREATED&lt;/STRONG&gt;. QUERY_FOR_HD_YTD is a table in SAS that is resulted from importing a data in sas. it is clear that &amp;amp;MonthStartDate is in the same data type of REG_CREATED. Now my question is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &amp;amp;MonthStartDate variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 03:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102097#M28652</guid>
      <dc:creator>sugita</dc:creator>
      <dc:date>2012-05-04T03:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: comparing varchar</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102098#M28653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont know it would be useful for you or not...but just give a try...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check these options in SAS documentation.SASDATEFMT and DBSASTYPE options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 04:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comparing-varchar/m-p/102098#M28653</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-05-04T04:38:43Z</dc:date>
    </item>
  </channel>
</rss>

