<?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 Can not resolve date parameter in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Can-not-resolve-date-parameter/m-p/7414#M2346</link>
    <description>I am having problem with date parameter not resolving when I tried bringing it as string . I used date parameter  in proc sql in where clause . It brings no rows. Following is the code I used. Please help.&lt;BR /&gt;
 &lt;BR /&gt;
&lt;BR /&gt;
/* CONVERTs date parm as ''string data type  FROM PARAMETER SCREEN 01/09/2008 */&lt;BR /&gt;
DATA temp1;&lt;BR /&gt;
	FROM_DATE = ("&amp;amp;frdate");&lt;BR /&gt;
	TO_DATE =("&amp;amp;todate");&lt;BR /&gt;
	SASFROMDT=INPUT("&amp;amp;frdate",MMDDYY10.);&lt;BR /&gt;
	SASTODT=INPUT("&amp;amp;todate",MMDDYY10.);&lt;BR /&gt;
	&lt;BR /&gt;
	CALL SYMPUT('SASFRDATE',SASFROMDT);&lt;BR /&gt;
	CALL SYMPUT('SASTODATE',SASTODT);&lt;BR /&gt;
	put SASFROMDT=   SASTODT=  ;&lt;BR /&gt;
	run;&lt;BR /&gt;
	%put  &amp;amp;frdate &amp;amp;todate &amp;amp;SASFRDATE &amp;amp;SASTODATE;&lt;BR /&gt;
&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
 CREATE TABLE trans_file AS SELECT DISTINCT TRANSACTION_HISTORY.DOCUMENT FORMAT=$63.,	 &lt;BR /&gt;
	 datepart(TRANSACTION_HISTORY.TRANSACTION_DATE) FORMAT=date9. as TRANS_DATE,&lt;BR /&gt;
	 TRANSACTION_HISTORY.TRANSACTION_DESC FORMAT=$255.,&lt;BR /&gt;
	 TRANSACTION_HISTORY.ITEM,&lt;BR /&gt;
	 TRANSACTION_HISTORY.SEQUENCE_NUMBER,&lt;BR /&gt;
	TRANSACTION_HISTORY.FIELD_CODE FORMAT=$63.,	 &lt;BR /&gt;
	 TRANSACTION_HISTORY.FISCAL_YEAR FORMAT=$63.,&lt;BR /&gt;
	sum (TRANSACTION_HISTORY.TRANSACTION_AMOUNT) as TRANS_AMT,&lt;BR /&gt;
	 TRANSACTION_HISTORY.ACCOUNT FORMAT=$63.	 &lt;BR /&gt;
 FROM ODSP.TRANSACTION_HISTORY AS TRANSACTION_HISTORY	  &lt;BR /&gt;
  WHERE datepart(TRANSACTION_HISTORY.TRANSACTION_DATE) = &amp;amp;SASFRDATE&lt;BR /&gt;
 GROUP BY VENDOR_ID,ACCOUNT&lt;BR /&gt;
 ORDER BY TRANSACTION_HISTORY.FUND ,TRANSACTION_HISTORY.ACCOUNT ;&lt;BR /&gt;
QUIT;</description>
    <pubDate>Tue, 11 Mar 2008 20:08:20 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-03-11T20:08:20Z</dc:date>
    <item>
      <title>Can not resolve date parameter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Can-not-resolve-date-parameter/m-p/7414#M2346</link>
      <description>I am having problem with date parameter not resolving when I tried bringing it as string . I used date parameter  in proc sql in where clause . It brings no rows. Following is the code I used. Please help.&lt;BR /&gt;
 &lt;BR /&gt;
&lt;BR /&gt;
/* CONVERTs date parm as ''string data type  FROM PARAMETER SCREEN 01/09/2008 */&lt;BR /&gt;
DATA temp1;&lt;BR /&gt;
	FROM_DATE = ("&amp;amp;frdate");&lt;BR /&gt;
	TO_DATE =("&amp;amp;todate");&lt;BR /&gt;
	SASFROMDT=INPUT("&amp;amp;frdate",MMDDYY10.);&lt;BR /&gt;
	SASTODT=INPUT("&amp;amp;todate",MMDDYY10.);&lt;BR /&gt;
	&lt;BR /&gt;
	CALL SYMPUT('SASFRDATE',SASFROMDT);&lt;BR /&gt;
	CALL SYMPUT('SASTODATE',SASTODT);&lt;BR /&gt;
	put SASFROMDT=   SASTODT=  ;&lt;BR /&gt;
	run;&lt;BR /&gt;
	%put  &amp;amp;frdate &amp;amp;todate &amp;amp;SASFRDATE &amp;amp;SASTODATE;&lt;BR /&gt;
&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
 CREATE TABLE trans_file AS SELECT DISTINCT TRANSACTION_HISTORY.DOCUMENT FORMAT=$63.,	 &lt;BR /&gt;
	 datepart(TRANSACTION_HISTORY.TRANSACTION_DATE) FORMAT=date9. as TRANS_DATE,&lt;BR /&gt;
	 TRANSACTION_HISTORY.TRANSACTION_DESC FORMAT=$255.,&lt;BR /&gt;
	 TRANSACTION_HISTORY.ITEM,&lt;BR /&gt;
	 TRANSACTION_HISTORY.SEQUENCE_NUMBER,&lt;BR /&gt;
	TRANSACTION_HISTORY.FIELD_CODE FORMAT=$63.,	 &lt;BR /&gt;
	 TRANSACTION_HISTORY.FISCAL_YEAR FORMAT=$63.,&lt;BR /&gt;
	sum (TRANSACTION_HISTORY.TRANSACTION_AMOUNT) as TRANS_AMT,&lt;BR /&gt;
	 TRANSACTION_HISTORY.ACCOUNT FORMAT=$63.	 &lt;BR /&gt;
 FROM ODSP.TRANSACTION_HISTORY AS TRANSACTION_HISTORY	  &lt;BR /&gt;
  WHERE datepart(TRANSACTION_HISTORY.TRANSACTION_DATE) = &amp;amp;SASFRDATE&lt;BR /&gt;
 GROUP BY VENDOR_ID,ACCOUNT&lt;BR /&gt;
 ORDER BY TRANSACTION_HISTORY.FUND ,TRANSACTION_HISTORY.ACCOUNT ;&lt;BR /&gt;
QUIT;</description>
      <pubDate>Tue, 11 Mar 2008 20:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Can-not-resolve-date-parameter/m-p/7414#M2346</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-11T20:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can not resolve date parameter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Can-not-resolve-date-parameter/m-p/7415#M2347</link>
      <description>Formats and informats only apply to printing and inputing data.&lt;BR /&gt;
SAS stores data as either a character string or as a number.&lt;BR /&gt;
I expect that TRANSACTION_DATE is a numeric that has a date format associated with it to make it a "date type" value.&lt;BR /&gt;
&lt;BR /&gt;
So, you need the actual numeric value to use for the comparison.&lt;BR /&gt;
&lt;BR /&gt;
If you had been using "pass-through" to connect to an Oracle or MS SQL Server or other RDMS, then you would need to convert the where value to a text value inclosed in quotes with the correct format for the RDMS.</description>
      <pubDate>Tue, 11 Mar 2008 21:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Can-not-resolve-date-parameter/m-p/7415#M2347</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-11T21:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can not resolve date parameter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Can-not-resolve-date-parameter/m-p/7416#M2348</link>
      <description>Hi Chuck,&lt;BR /&gt;
The same code worked in EG 3.0.  Anyway, how do I convert &amp;amp;SASFRDATE  to text format . can you please give sample code?</description>
      <pubDate>Tue, 11 Mar 2008 21:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Can-not-resolve-date-parameter/m-p/7416#M2348</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-11T21:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can not resolve date parameter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Can-not-resolve-date-parameter/m-p/7417#M2349</link>
      <description>Hi:&lt;BR /&gt;
  The DATEPART function returns a number. So, in the program below, the DATE portion of the datetime variable D_T is -3334, the internal representation of Nov 15, 1950.&lt;BR /&gt;
 &lt;BR /&gt;
  Consider this program:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data testdate;&lt;BR /&gt;
  d_t = '15nov1950:23:45'dt;&lt;BR /&gt;
  date = datepart(d_t);&lt;BR /&gt;
  put _all_;&lt;BR /&gt;
  put "The date is";&lt;BR /&gt;
  put date worddate.;&lt;BR /&gt;
  put date mmddyy10.;&lt;BR /&gt;
  put date monyy5.;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Results in the following in the SAS Log:&lt;BR /&gt;
[pre]&lt;BR /&gt;
d_t=-287972100 date=-3334 _ERROR_=0 _N_=1&lt;BR /&gt;
The date is&lt;BR /&gt;
 November 15, 1950&lt;BR /&gt;
11/15/1950&lt;BR /&gt;
NOV50&lt;BR /&gt;
NOTE: The data set WORK.TESTDATE has 1 observations and 2 variables.&lt;BR /&gt;
 &lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
Since your WHERE clause is using the DATEPART function on your date variable, then it is appropriate for you to specify a number for comparison...you either have to do that or specify a date constant.&lt;BR /&gt;
 &lt;BR /&gt;
So, for example, a WHERE statement/clause that used the above datetime variable could be built this way:&lt;BR /&gt;
[pre]&lt;BR /&gt;
where datepart(d_t) = -3334;&lt;BR /&gt;
where datepart(d_t) = '15nov1950'd;&lt;BR /&gt;
OR&lt;BR /&gt;
%let fromdate = -3334;&lt;BR /&gt;
where datepart(d_t) = &amp;amp;fromdate; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
Have you checked that the data did not change and that there ARE dates that exactly equal the from date? &lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 12 Mar 2008 01:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Can-not-resolve-date-parameter/m-p/7417#M2349</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-12T01:06:34Z</dc:date>
    </item>
  </channel>
</rss>

