<?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: Creating a variable and populating it with current date in SAS DI Studio in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-variable-and-populating-it-with-current-date-in-SAS/m-p/229968#M5633</link>
    <description>&lt;P&gt;&amp;amp;sysdate contains a string and not a SAS date value. That's why your code throws an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As expression use either:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"&amp;amp;sysdate"d&lt;/EM&gt; &amp;nbsp; or &amp;nbsp; &lt;EM&gt;date()&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You then need also to apply a &lt;EM&gt;date9.&lt;/EM&gt; format for your target column SNAPSHOT_DATE.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Oct 2015 20:25:10 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2015-10-14T20:25:10Z</dc:date>
    <item>
      <title>Creating a variable and populating it with current date in SAS DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-variable-and-populating-it-with-current-date-in-SAS/m-p/229941#M5632</link>
      <description>&lt;P&gt;I am extracting fields from an Oracle Table using the Transformation &amp;gt; SQL &amp;gt; Extract transformation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Within the Extract transformation, on the mappings tab, I have created a two new variables/columns and given each an expression.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;column ------------ expression&lt;/LI&gt;
&lt;LI&gt;stc_crs_sec ------ trim(stc_course_name)||'*'||trim(stc_section_no)&lt;/LI&gt;
&lt;LI&gt;snapshot_date -- &amp;amp;sysdate&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After some manipulations, I will load this data into another Oracle table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the date portion is giving me an issue. I added it, so the expression for the column stc_crs_sec is working just fine. However, after adding the date, the job fails with the following errors:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, , =, , =, &amp;gt;, &amp;gt;=, ?, AND, CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And when I look at the log, I get:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;3768                (&amp;amp;SYSDATE) as SNAPSHOT_DATE length = 8
NOTE: Line generated by the macro variable "SYSDATE".
3768       14OCT15
             _____
             22
             76
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, CONTAINS, EQ, 
              EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.  

ERROR 76-322: Syntax error, statement will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What I don't understand is - I'm not comparing it, I just want 14OCT15 to be placed into the column "Snapshot_Date" for each observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I accomplish this?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2015 16:57:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-variable-and-populating-it-with-current-date-in-SAS/m-p/229941#M5632</guid>
      <dc:creator>GregG</dc:creator>
      <dc:date>2015-10-14T16:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a variable and populating it with current date in SAS DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-variable-and-populating-it-with-current-date-in-SAS/m-p/229968#M5633</link>
      <description>&lt;P&gt;&amp;amp;sysdate contains a string and not a SAS date value. That's why your code throws an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As expression use either:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"&amp;amp;sysdate"d&lt;/EM&gt; &amp;nbsp; or &amp;nbsp; &lt;EM&gt;date()&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You then need also to apply a &lt;EM&gt;date9.&lt;/EM&gt; format for your target column SNAPSHOT_DATE.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2015 20:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-variable-and-populating-it-with-current-date-in-SAS/m-p/229968#M5633</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-10-14T20:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a variable and populating it with current date in SAS DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-variable-and-populating-it-with-current-date-in-SAS/m-p/230084#M5634</link>
      <description>&lt;P&gt;That seems to have added an additional error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Mapping columns ...
5307       proc sql;
5308          create view work.W1PO1ZZ7 as
5309             select
5310                STC_PERSON_ID as STU_ID,
5311                STC_COURSE_NAME,
5312                STC_TERM,
5313                STC_SECTION_NO,
5314                (TRIM(STC_COURSE_NAME)||'*'||TRIM(STC_SECTION_NO)) as STC_CRS_SEC length = 8,
5315                &amp;amp;SYSDATE as SNAPSHOT_DATE length = 8
                                              ______
                                              22
                                              76
ERROR 22-322: Syntax error, expecting one of the following: GROUP, HAVING, ORDER, WHERE.  

ERROR 76-322: Syntax error, statement will be ignored.

NOTE: Line generated by the macro variable "SYSDATE".
5315                 14OCT15
                       _____
                       22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, AS, 
              CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.  

5316          from &amp;amp;SYSLAST
5317             where STC_TERM = '15/FA'
5318          ;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
5319       quit;
174                                                        The SAS System                          09:27 Wednesday, October 14, 2015

NOTE: The SAS System stopped processing this step because of errors.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And here is a picture of my Extract Transformation Mappings tab:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/510i24531D1F9D95143B/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="extract2.png" title="extract2.png" /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12015i445EABE4D62D291B/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="extract.png" title="extract.png" /&gt;</description>
      <pubDate>Thu, 15 Oct 2015 13:44:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-variable-and-populating-it-with-current-date-in-SAS/m-p/230084#M5634</guid>
      <dc:creator>GregG</dc:creator>
      <dc:date>2015-10-15T13:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a variable and populating it with current date in SAS DI Studio</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-variable-and-populating-it-with-current-date-in-SAS/m-p/230137#M5635</link>
      <description>&lt;P&gt;Thank you, I solved my problem. I don't know why, but I had to shut down DI Studio twice before the solution you offered would actually work. Now it works fine though. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 18:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-variable-and-populating-it-with-current-date-in-SAS/m-p/230137#M5635</guid>
      <dc:creator>GregG</dc:creator>
      <dc:date>2015-10-15T18:53:12Z</dc:date>
    </item>
  </channel>
</rss>

