<?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 how to format date IN SAS7BDAT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-format-date-IN-SAS7BDAT/m-p/358572#M84292</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;data new;&lt;BR /&gt;set '/folders/myshortcuts/myfolder/aprsales.sas7bdat';&lt;BR /&gt;format date9.;&lt;BR /&gt;run;&lt;/DIV&gt;</description>
    <pubDate>Sun, 14 May 2017 17:29:38 GMT</pubDate>
    <dc:creator>mageshb</dc:creator>
    <dc:date>2017-05-14T17:29:38Z</dc:date>
    <item>
      <title>how to format date IN SAS7BDAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-format-date-IN-SAS7BDAT/m-p/358572#M84292</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;data new;&lt;BR /&gt;set '/folders/myshortcuts/myfolder/aprsales.sas7bdat';&lt;BR /&gt;format date9.;&lt;BR /&gt;run;&lt;/DIV&gt;</description>
      <pubDate>Sun, 14 May 2017 17:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-format-date-IN-SAS7BDAT/m-p/358572#M84292</guid>
      <dc:creator>mageshb</dc:creator>
      <dc:date>2017-05-14T17:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to format date IN SAS7BDAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-format-date-IN-SAS7BDAT/m-p/358577#M84293</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I would expect you are getting that error message on the FORMAT statement, because the statement is incorrect. Is this what you are seeing?&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8873i52927C81A116F8DA/image-size/original?v=1.0&amp;amp;px=-1" alt="bad_fmt_stmt.png" title="bad_fmt_stmt.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically, in a format statement, you have:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;format &lt;FONT color="#FF0000"&gt;variable&lt;/FONT&gt; formatname.; /* for numeric variables */&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;format &lt;FONT color="#FF0000"&gt;variable&lt;/FONT&gt; $fmtname.; /* for character variables */&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;You are missing the name of the variable that you want to format in the statement.&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;cynthia&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;ps, also consider you investigate the use of the LIBNAME statement rather than the fully qualified path and operating system name of the SAS dataset...but that is just a suggestion.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2017 18:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-format-date-IN-SAS7BDAT/m-p/358577#M84293</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-05-14T18:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to format date IN SAS7BDAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-format-date-IN-SAS7BDAT/m-p/358581#M84294</link>
      <description>&lt;P&gt;You should do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Fix your SAS UE setup - you need to create a folder called myfolders not myfolder - it's why you possibly had issues with getting it set up. Place the file in that folder. You can continue to use your current setup but it's probably easier in the long run to set it up correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Set up a library to the location where you save your SAS datasets. You can point directly to the file like you've done but you'll almost never seen that done anywhere.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. As indicated your FORMAT statement is incorrect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code snippet below may help. FYI - you do not need to format the date to filter it first to get only the dates of interest. As long as the variable IS a SAS date, so numeric with a date format (date9, yymmdd8, monyy7.) then you can filter it as desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname myFiles '/folders/myshortcuts/myfolder/';

data new;
    set myFiles.aprsales;

    format  MY_DATE_VARIABLE date9.;&lt;BR /&gt;&lt;BR /&gt;    *Filter for less than Jan dates;&lt;BR /&gt;    WHERE MY_DATE_VARIABLE &amp;lt;= "01Jan2016"d;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 May 2017 18:48:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-format-date-IN-SAS7BDAT/m-p/358581#M84294</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-14T18:48:21Z</dc:date>
    </item>
  </channel>
</rss>

