<?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: Date format in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3249#M1437</link>
    <description>David,&lt;BR /&gt;
&lt;BR /&gt;
I agree with you in terms that DAY, MONTH, YEAR and SUBSTR etc. is generally not the most efficient way creating these types of display formats and I would generally use Cynthia's PICTURE format (very under-used in my experience!).&lt;BR /&gt;
&lt;BR /&gt;
However, if you work in clinical trials as I do, you get plenty of partial dates (day or day and month unknown) so to list this data you often have to create character equivalents of the form: "XX-JUN-2007" or similar.&lt;BR /&gt;
&lt;BR /&gt;
In this case, I would use the character functions. &lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Lawrence</description>
    <pubDate>Fri, 08 Jun 2007 10:55:46 GMT</pubDate>
    <dc:creator>LawrenceHW</dc:creator>
    <dc:date>2007-06-08T10:55:46Z</dc:date>
    <item>
      <title>Date format</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3244#M1432</link>
      <description>Hi there,&lt;BR /&gt;
I have to use a date format like this: 01-jan-07 but I can not find out how to use it in SAS. I know there is a similar format: 01.jan.07 or 01jan07 but how can I put the dash?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance!&lt;BR /&gt;
Juan Vte.</description>
      <pubDate>Tue, 29 May 2007 08:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3244#M1432</guid>
      <dc:creator>JuanVte</dc:creator>
      <dc:date>2007-05-29T08:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3245#M1433</link>
      <description>Hi:&lt;BR /&gt;
  If you make a PICTURE format and use a DATE "directive", you can insert the hyphens into any kind of date format you want to design. Some of the SAS formats allow you to specify a separator, but the DATE7 and DATE9 formats don't fall into that category.&lt;BR /&gt;
  &lt;BR /&gt;
  In this program, I have a PROC FORMAT that sets up the special date PICTURE format and then my PROC PRINT uses the format -- and shows some other formats by way of comparison. &lt;BR /&gt;
  &lt;BR /&gt;
  If you need more help using PROC FORMAT for setting a PICTURE format, I recommend that you start with this SUGI paper:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi31/243-31.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi31/243-31.pdf&lt;/A&gt; or contact Tech Support.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
*** the code;&lt;BR /&gt;
** first make some test data;&lt;BR /&gt;
data testdate;&lt;BR /&gt;
  length name $20;&lt;BR /&gt;
  infile datalines dsd;&lt;BR /&gt;
  input name $ bdate : date9.;&lt;BR /&gt;
  bdate1 = bdate;&lt;BR /&gt;
  bdate2 = bdate;&lt;BR /&gt;
  bdate3 = bdate;&lt;BR /&gt;
  bdate4 = bdate;&lt;BR /&gt;
  bdate5 = bdate;&lt;BR /&gt;
  bdate6 = bdate;&lt;BR /&gt;
  return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
"Sam Waterston",15NOV1940&lt;BR /&gt;
"Petula Clark",15NOV1932&lt;BR /&gt;
"Liv Tyler",01JUL1977&lt;BR /&gt;
"Emilio Estevez",12MAY1962&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
    &lt;BR /&gt;
** using date directives to make a picture format;&lt;BR /&gt;
proc format;&lt;BR /&gt;
  picture bd low-high='%0d-%b-%y'  (datatype=date);&lt;BR /&gt;
  picture bd_alt low-high = '%0d-%b-%Y%y' (datatype=date);&lt;BR /&gt;
run;&lt;BR /&gt;
    &lt;BR /&gt;
** formatting date multiple ways;&lt;BR /&gt;
proc print data=testdate label;&lt;BR /&gt;
title 'Show Biz Bdays';&lt;BR /&gt;
label bdate = 'Internal Number for Date'&lt;BR /&gt;
      bdate1 = 'Used DATE7. format' &lt;BR /&gt;
	  bdate2 = 'Picture Format Dashes, 2-digit year' &lt;BR /&gt;
      bdate3 = 'Picture Format Dashes, 4-digit year'&lt;BR /&gt;
	  bdate4 = 'Used DATE9. format' &lt;BR /&gt;
	  bdate5 = 'Used MMDDYY10. format' &lt;BR /&gt;
	  bdate6 = 'Used ddmmyyd11. format'; &lt;BR /&gt;
format  bdate1 date7. bdate2 bd. bdate3 bd_alt.&lt;BR /&gt;
        bdate4 date9. bdate5 mmddyy10. bdate6 ddmmyyd10.;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 29 May 2007 14:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3245#M1433</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-05-29T14:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3246#M1434</link>
      <description>data testdates;&lt;BR /&gt;
input id_no name $ start_date date9.;&lt;BR /&gt;
cards;&lt;BR /&gt;
1 Venu 15NOV2005&lt;BR /&gt;
2 Prem 23DEC2005&lt;BR /&gt;
3 Tyler 25JAN2006&lt;BR /&gt;
4 Clark 28JAN2006&lt;BR /&gt;
5 Sam 02MAR2006&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
/*proc print data = testdates;&lt;BR /&gt;
format start_date ddmmyyd10.;&lt;BR /&gt;
run;*/&lt;BR /&gt;
proc report data = testdates nowd split='#' headline headskip;&lt;BR /&gt;
column id_no name start_date;&lt;BR /&gt;
define id_no/display "IDENTIFICATION#NUMBER";&lt;BR /&gt;
define name/display "NAME OF THE #EMPLOYEE";&lt;BR /&gt;
define start_date/display "DATE OF #JOINING" format=ddmmyyd10.;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 30 May 2007 11:16:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3246#M1434</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-05-30T11:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3247#M1435</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
   You can seperate the Day ,Month and Year from the DATE varaible by using the functions like PUT,SUBSTR,YEAR.&lt;BR /&gt;
   Convert the DATE varaible from numeric  to Character Data Type by using PUT function ,Beacuse DATE varaible is a Numeric Data Type.After seperating the Day,Month and Year from the DATE varaible.&lt;BR /&gt;
&lt;BR /&gt;
   You can concatenate the Day,Month,Year and hypen symbol ('-') by using the CAT function or Concatente symbol (||).&lt;BR /&gt;
&lt;BR /&gt;
Program:--&lt;BR /&gt;
&lt;BR /&gt;
data testdates;&lt;BR /&gt;
  input id_no name $ st_date date9.;&lt;BR /&gt;
  date = st_date;&lt;BR /&gt;
  new1 = put(date,date.);&lt;BR /&gt;
  month = substr(new1,3,3);&lt;BR /&gt;
  day = substr(new1,1,2);&lt;BR /&gt;
  year = year(st_date);&lt;BR /&gt;
  new_date = compress(day||'-'||month||'-'||year);&lt;BR /&gt;
cards;&lt;BR /&gt;
1 Venu 15NOV2005&lt;BR /&gt;
2 Prem 23DEC2005&lt;BR /&gt;
3 Tyler 25JAN2006&lt;BR /&gt;
4 Clark 28JAN2006&lt;BR /&gt;
5 Sam 02MAR2006&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data = testdates;&lt;BR /&gt;
var day month year new_date;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 31 May 2007 07:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3247#M1435</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-05-31T07:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3248#M1436</link>
      <description>Converting dates to strings and substringing is a poor idea IMHO.  There are many very good functions in SAS that allow parsing out the date elements.&lt;BR /&gt;
&lt;BR /&gt;
The Day() and Year() functions will extract the values, and the month name can be added by using the MonName. format.&lt;BR /&gt;
&lt;BR /&gt;
Having said that, the most elegant solution remains the one that creates a custom picture format.  As usual, the Queen of ODS demonstrates that there is little she can't do to give you data as you like it.&lt;BR /&gt;
&lt;BR /&gt;
Kind regards&lt;BR /&gt;
&lt;BR /&gt;
David&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
P.S. again for forum support: and the dictionary doesn't know ODS either.  Could the dictionary be loaded with the procedure names and standard SAS syntax?</description>
      <pubDate>Thu, 31 May 2007 09:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3248#M1436</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-05-31T09:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3249#M1437</link>
      <description>David,&lt;BR /&gt;
&lt;BR /&gt;
I agree with you in terms that DAY, MONTH, YEAR and SUBSTR etc. is generally not the most efficient way creating these types of display formats and I would generally use Cynthia's PICTURE format (very under-used in my experience!).&lt;BR /&gt;
&lt;BR /&gt;
However, if you work in clinical trials as I do, you get plenty of partial dates (day or day and month unknown) so to list this data you often have to create character equivalents of the form: "XX-JUN-2007" or similar.&lt;BR /&gt;
&lt;BR /&gt;
In this case, I would use the character functions. &lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Lawrence</description>
      <pubDate>Fri, 08 Jun 2007 10:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-format/m-p/3249#M1437</guid>
      <dc:creator>LawrenceHW</dc:creator>
      <dc:date>2007-06-08T10:55:46Z</dc:date>
    </item>
  </channel>
</rss>

