<?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: How to use format and formatedlength options in proc casutil load data ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694317#M211737</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248988"&gt;@yatinrao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Tom &lt;BR /&gt;&lt;BR /&gt;I am only trying to get the DATE part of the field . time part is all zeroes in the original oracle table. &lt;BR /&gt;&lt;BR /&gt;Yatin&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Which is why you had to use a format designed to work with datetime values and not date values. Such as DATETIME, DTDATE, etc.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Oct 2020 18:19:51 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-10-26T18:19:51Z</dc:date>
    <item>
      <title>How to use format and formatedlength options in proc casutil load data ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/693894#M211592</link>
      <description>&lt;P&gt;I am trying to load data from oracle into SAS . for a date field SAS by default treats it as datetime field.&lt;/P&gt;
&lt;P&gt;how do I trim the datetime to date in the load call&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my code looks something like this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc casutil;&lt;/P&gt;
&lt;P&gt;load casdata="WSPLIT" casout="WSPLIT"&lt;BR /&gt;vars=&lt;BR /&gt;(&lt;BR /&gt;(NAME="ROW_DATE",format='ddmonyyyy' formattedlength=9 ),&lt;/P&gt;
&lt;P&gt;(NAME="ROW_DATE",format='DATE9' formattedlength=9 ),&lt;/P&gt;
&lt;P&gt;/*(NAME="ROW_DATE"),*/&lt;BR /&gt;(NAME="ABCD"),&lt;/P&gt;
&lt;P&gt;)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;incaslib="MAIN" outcaslib="DBORA" ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if I use the commented line row_date shows up like 05OCT2020 00:00:00... the uncommented format&amp;nbsp;&lt;/P&gt;
&lt;P&gt;gets me date in 1917388800, I am trying to get just&amp;nbsp;05OCT2020&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Documentation just says&lt;/P&gt;
&lt;P&gt;FORMAT="string"&lt;BR /&gt;specifies the format to apply to the variable.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 19:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/693894#M211592</guid>
      <dc:creator>yatinrao</dc:creator>
      <dc:date>2020-10-23T19:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use format and formatedlength options in proc casutil load data ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/693944#M211607</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248988"&gt;@yatinrao&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have Viya where I work, so let me ask what may be a dumb question:&amp;nbsp; Can you use a function?&amp;nbsp; In more traditional implementations of SAS, I would use the DATEPART function, something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc casutil;
load casdata="WSPLIT" casout="WSPLIT"
vars=
(
(NAME="ROW_DATE",format='ddmonyyyy' formattedlength=9 ),
(NAME="ROW_DATE",DATEPART(Row_Date),format='DATE9' formattedlength=9 ),
(NAME="ABCD"),
) 
incaslib="MAIN" outcaslib="DBORA" ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you can't use a function, can you create a view and then use the view in conjunction with the CASUTIL/Load CAS data?&amp;nbsp; Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE VIEW My_Lib.My_View  AS 
    SELECT  DATEPART(Oracle_Date_Column ) AS Row_Date FORMAT=DATE9.
        FROM Some_Lib.Some_Table;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course you'd want to add more columns, and you'd want to check my syntax, but if you can create a view, you could create the view with the proper data types for your situation, and then use CASUTIL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just throwing out some ideas.&amp;nbsp; Discard if of no help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 23:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/693944#M211607</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-23T23:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use format and formatedlength options in proc casutil load data ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694227#M211706</link>
      <description>Jim &lt;BR /&gt;&lt;BR /&gt;I have tried the first suggestion "(NAME="ROW_DATE",format='ddmonyyyy' formattedlength=9 )" but that just generates a number.  I will try the second one today. I do believe almost SAS9.4 code work in Viya also it is likely that this code executes in the SPRE environment.&lt;BR /&gt;thanks for your suggestion . SAS Documentation is lacking in this regard.&lt;BR /&gt;&lt;BR /&gt;Yatin</description>
      <pubDate>Mon, 26 Oct 2020 13:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694227#M211706</guid>
      <dc:creator>yatinrao</dc:creator>
      <dc:date>2020-10-26T13:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use format and formatedlength options in proc casutil load data ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694272#M211722</link>
      <description>Jim &lt;BR /&gt;&lt;BR /&gt;I used format="DATETIME9" FORMATTEDLENGTH=9  which seems to work. &lt;BR /&gt;&lt;BR /&gt;Yatin</description>
      <pubDate>Mon, 26 Oct 2020 15:39:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694272#M211722</guid>
      <dc:creator>yatinrao</dc:creator>
      <dc:date>2020-10-26T15:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use format and formatedlength options in proc casutil load data ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694283#M211727</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248988"&gt;@yatinrao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Jim &lt;BR /&gt;&lt;BR /&gt;I used format="DATETIME9" FORMATTEDLENGTH=9 which seems to work. &lt;BR /&gt;&lt;BR /&gt;Yatin&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There is a big difference between a datetime values (number of seconds) and a date value (number of days) that the DATE format requires. In addition to DATETIME9 there is also the DTDATE9 format for datetime values that displays only the day part.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 16:11:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694283#M211727</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-10-26T16:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use format and formatedlength options in proc casutil load data ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694312#M211734</link>
      <description>Tom &lt;BR /&gt;&lt;BR /&gt;I am only trying to get the DATE part of the field . time part is all zeroes in the original oracle table. &lt;BR /&gt;&lt;BR /&gt;Yatin</description>
      <pubDate>Mon, 26 Oct 2020 17:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694312#M211734</guid>
      <dc:creator>yatinrao</dc:creator>
      <dc:date>2020-10-26T17:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use format and formatedlength options in proc casutil load data ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694317#M211737</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248988"&gt;@yatinrao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Tom &lt;BR /&gt;&lt;BR /&gt;I am only trying to get the DATE part of the field . time part is all zeroes in the original oracle table. &lt;BR /&gt;&lt;BR /&gt;Yatin&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Which is why you had to use a format designed to work with datetime values and not date values. Such as DATETIME, DTDATE, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 18:19:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-format-and-formatedlength-options-in-proc-casutil/m-p/694317#M211737</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-10-26T18:19:51Z</dc:date>
    </item>
  </channel>
</rss>

