<?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: Create a Dynamic Date Variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516708#M3218</link>
    <description>The code runs just fine so I'm not sure what I'm looking for here. Why would I need to check the order of operation?</description>
    <pubDate>Wed, 28 Nov 2018 14:51:20 GMT</pubDate>
    <dc:creator>aperansi</dc:creator>
    <dc:date>2018-11-28T14:51:20Z</dc:date>
    <item>
      <title>Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516363#M3129</link>
      <description>&lt;P&gt;I am looking to create a date variable that grabs the current date, and 60 days before the current date. Currently, I am using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let startdate = '2018-09-23';
%let enddate = '2018-11-01';

%let start_dt = '23sep2018:00:00:00'dt;
%let end_dt = '01nov2018:00:00:00'dt; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can someone please help me figure out how to do this so that every month I dont have to manually update the dates? I need the dates in the format that I have specified above as well because I am running the initial query using a PROC SQL statement.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516363#M3129</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T16:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516368#M3131</link>
      <description>&lt;P&gt;Okay, so I hope you realize that your example has more than 60 days between startdate and enddate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if you want macro variable to contain date formatted as 2018-11-01, you are making your life hard. It could contain 01NOV18, which would be much easier to work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, assuming you have enddate and you want to compute 60 days earlier&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    enddate='01NOV18'd;
    startdate=intnx('day',enddate,-60);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you can turn these into macro variables using CALL SYMPUTX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    enddate='01NOV18'd;
    call symputx('enddate',enddate);
    startdate=intnx('day',enddate,-60);
    call symputx('startdate',startdate);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Your SQL does not require formatted macro variables, it simply requires the actual SAS date (which is an integer, which is what the above produces) unless you are doing a passthru to some database where SAS dates won't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    select ... from ... where datevariable&amp;gt;=&amp;amp;startdate and datevariable&amp;lt;=&amp;amp;enddate;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516368#M3131</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-27T16:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516369#M3132</link>
      <description>I do realize that part. I used the old variables for my example so they werent update with the correct 60 day period. I will try what you have mentioned above and see what my outcome is.</description>
      <pubDate>Tue, 27 Nov 2018 16:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516369#M3132</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T16:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516375#M3134</link>
      <description>&lt;P&gt;I used the following and no data returned back in my data sets unfortunately.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I need to calculate todays date without me manually having to input the date. Is this possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    enddate='01NOV18'd;
    startdate=intnx('day',enddate,-60);
    start_dt = '01NOV18'd;
    end_dt = intnx('day',enddate,-60);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516375#M3134</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T16:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516376#M3135</link>
      <description>&lt;P&gt;Also, you mention that you wanted to find the date 60 days before today. You can use the today function to dynamically get today's date so you don't have to hard code it in each time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; _null_&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
    enddate&lt;SPAN class="token operator"&gt;=today()&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
    startdate&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;intnx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'day'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;enddate&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-60&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516376#M3135</guid>
      <dc:creator>KDG</dc:creator>
      <dc:date>2018-11-27T16:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516379#M3136</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/228641"&gt;@aperansi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I used the following and no data returned back in my data sets unfortunately.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I need to calculate todays date without me manually having to input the date. Is this possible?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    enddate='01NOV18'd;
    startdate=intnx('day',enddate,-60);
    start_dt = '01NOV18'd;
    end_dt = intnx('day',enddate,-60);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, you have changed the code that I provided and so now you are getting nothing. If you run the code that I provided that contains CALL SYMPUTX, you get macro variables. You never get data set variables this way.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516379#M3136</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-27T16:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516382#M3137</link>
      <description>&lt;P&gt;The reason you didn't get any data is because the code creates a "null" dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this instead:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; test&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
    enddate&lt;SPAN class="token operator"&gt;=today()&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
    startdate&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;intnx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'day'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;enddate&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-60&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;    format enddate startdate mmddyyd10.;&lt;BR /&gt;run; &lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:29:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516382#M3137</guid>
      <dc:creator>KDG</dc:creator>
      <dc:date>2018-11-27T16:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516386#M3139</link>
      <description>format enddate startdate yymmddd10.;</description>
      <pubDate>Tue, 27 Nov 2018 16:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516386#M3139</guid>
      <dc:creator>KDG</dc:creator>
      <dc:date>2018-11-27T16:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516389#M3141</link>
      <description>&lt;P&gt;I went back to the code you mentioned and used it, only making a slight adjustment to the start date.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    enddate=today();
    call symputx('enddate',enddate);
    startdate=intnx('day',enddate,-60);
    call symputx('startdate',startdate);
run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am still getting no data back in the datasets however.&amp;nbsp;&amp;nbsp;I am still very confused on using macro variables however. I used the symputx like you mentioned, so are you implying that I wouldnt receive anything back in the datasets I need?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:33:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516389#M3141</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T16:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516397#M3144</link>
      <description>&lt;P&gt;This is what I used, and I still dont receive any data back.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
    enddate=today();
    startdate=intnx('day',enddate,-60);    
	format enddate startdate yymmddd10.;
;run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also tried yymmdd10.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:38:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516397#M3144</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T16:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516398#M3145</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/228641"&gt;@aperansi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I went back to the code you mentioned and used it, only making a slight adjustment to the start date.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    enddate=today();
    call symputx('enddate',enddate);
    startdate=intnx('day',enddate,-60);
    call symputx('startdate',startdate);
run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am still getting no data back in the datasets however.&amp;nbsp;&amp;nbsp;I am still very confused on using macro variables however. I used the symputx like you mentioned, so are you implying that I wouldnt receive anything back in the datasets I need?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code creates macro variables only. It does not create data set variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After you run the data step, use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=enddate;
%put &amp;amp;=startdate;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to see the values of your macro variables. The results are written to the LOG. They will be integers. You could also use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put ENDDATE %sysfunc(putn(&amp;amp;enddate,date7.));
%put STARTDATE %sysfunc(putn(&amp;amp;startdate,date7.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to see the actual dates that they represent.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516398#M3145</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-27T16:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516405#M3149</link>
      <description>&lt;P&gt;That code will create a dataset called Test that has the 2 variables in it. Are you using EG or SAS Studio? Try putting&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print; run;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, look in your log and see if it says the dataset was created. If it was, it will be in your WORK library.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516405#M3149</guid>
      <dc:creator>KDG</dc:creator>
      <dc:date>2018-11-27T16:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516410#M3153</link>
      <description>&lt;P&gt;I am using SAS EG yes. I tried puting proc print; run; right after the intial code and I am still getting the same result unfortunately.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The datasets are being created, but are returning with 0 rows of data in the work library.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a piece of what I am seeing in the log:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;GOPTIONS ACCESSIBLE;
23         proc sql;
24         CONNECT TO odbc as myconn
24       ! (noprompt=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX);
25         
26         CREATE TABLE TUnionLD AS
27             select *
28             from connection to myconn
29              (
30                    SELECT  AD.AGENCY_DATA_KEY AS api_call,
31                            AD.DATE_ENTERED AS api_datetime
32                    FROM CUSTOMERSCORING.DBO.AGENCYDATA AD
33                    WHERE AD.AGENCY_MASTER_KEY in (68) AND AD.DATA_ERROR = 0 AND
34                         AD.DATE_ENTERED
SYMBOLGEN:  Macro variable STARTDATE resolves to 21455
34       !                                 &amp;gt;= &amp;amp;startdate. AND AD.DATE_ENTERED &amp;lt; &amp;amp;enddate.
SYMBOLGEN:  Macro variable ENDDATE resolves to 21515
35         
36                         )
37              ;
NOTE: Table WORK.TUNIONLD created, with 0 rows and 2 columns.

38         disconnect from myconn;
39         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.07 seconds
      cpu time            0.01 seconds&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:51:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516410#M3153</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T16:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516415#M3156</link>
      <description>&lt;P&gt;I did what you said, and used the following but still nothing is returning.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=enddate;
%put &amp;amp;=startdate&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I apologize for all of the questions, but I am very new and still dont have a very good understaning of SAS.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516415#M3156</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T16:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516428#M3160</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/228641"&gt;@aperansi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I did what you said, and used the following but still nothing is returning.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=enddate;
%put &amp;amp;=startdate&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I apologize for all of the questions, but I am very new and still dont have a very good understaning of SAS.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you look in the LOG?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 17:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516428#M3160</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-27T17:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516430#M3161</link>
      <description>&lt;P&gt;Yes I did look at the log, but not really sure what I'm looking for exactly. Nothing really sticks out to me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   
50         data _null_;
51             enddate=today();
52             call symputx('enddate',enddate);
53             startdate=intnx('day',enddate,-60);
54             call symputx('startdate',startdate);
55         	format endate startdate yymmdd10.;
56         run;

3                                                          The SAS System                            13:07 Monday, November 26, 2018

NOTE: Variable endate is uninitialized.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

57         
58         %put &amp;amp;=enddate;
SYMBOLGEN:  Macro variable ENDDATE resolves to 21515
ENDDATE=21515
59         %put &amp;amp;=startdate;
SYMBOLGEN:  Macro variable STARTDATE resolves to 21455
STARTDATE=21455
60         
61         GOPTIONS NOACCESSIBLE;
62         %LET _CLIENTTASKLABEL=;
63         %LET _CLIENTPROJECTPATH=;
64         %LET _CLIENTPROJECTNAME=;
65         %LET _SASPROGRAMFILE=;
66         
67         ;*';*";*/;quit;run;
68         ODS _ALL_ CLOSE;
69         
70         
71         QUIT; RUN;
72         &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Nov 2018 17:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516430#M3161</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T17:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516434#M3162</link>
      <description>&lt;P&gt;It says&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ENDDATE=21515
STARTDATE=21455&lt;/PRE&gt;
&lt;P&gt;which you will notice is exactly 60 days apart. Then you can use these macro variables in your SQL, as I explained near the beginning of this thread.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 17:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516434#M3162</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-27T17:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516436#M3163</link>
      <description>&lt;P&gt;Thank you for clearing that up for me. I used the macro variables like you mentioned in my SQL, but the column name is saying invalid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
CONNECT TO odbc as myconn (noprompt="server=canldsassqlrpt;DRIVER=SQL Server;Trusted_Connection=yes;database=customerScoring");

CREATE TABLE TUnionLD AS 
    select *
    from connection to myconn
     (
           SELECT  AD.AGENCY_DATA_KEY AS api_call,
                   AD.DATE_ENTERED AS api_datetime
           FROM CUSTOMERSCORING.DBO.AGENCYDATA AD
           WHERE AD.AGENCY_MASTER_KEY in (68) AND AD.DATA_ERROR = 0 AND
                AD.DATE_ENTERED &amp;gt;= startdate AND AD.DATE_ENTERED &amp;lt; enddate

                )
     ;
disconnect from myconn;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Nov 2018 18:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516436#M3163</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T18:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516437#M3164</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;AD.DATE_ENTERED &amp;gt;= &amp;amp;startdate AND AD.DATE_ENTERED &amp;lt; &amp;amp;enddate&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Nov 2018 18:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516437#M3164</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-27T18:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Dynamic Date Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516439#M3165</link>
      <description>&lt;P&gt;On the 13th message in this thread you just introduced a critical piece of information that you should have include in your initial report.&amp;nbsp; You are trying to use these "date" values in some remote database instead of in SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want help with generating valid code for that remote database you need to explain what syntax will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So get an example of the query that works using hard-coded dates and show us that code so we can help you replace the hardcoded dates that will be in the right syntax for that remote database to understand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 18:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-Dynamic-Date-Variable/m-p/516439#M3165</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-27T18:07:32Z</dc:date>
    </item>
  </channel>
</rss>

