From: "data _null_," on
150 data _null_;
151 input ymddttm $16.;
152 sasDTTM = input(ymddttm,ymddttm.);
153 put (_all_)(=);
154 format sas: datetime13.;
155 cards;

ymddttm=2006-01-12 12:24 sasDTTM=12JAN06:12:24
ymddttm=2006-01-12 12:25 sasDTTM=12JAN06:12:25


This assumes that the datepart is YYYY-MM-DD.


On Nov 22, 2007 10:17 AM, Li,Qian [Ontario] <Qian.Li(a)ec.gc.ca> wrote:
> Hello everyone,
>
> I have a question regarding converting ASCII data_time into SAS format.
> For example, the format in ASCII file is:
> 2006-01-12 12:24
> 2006-01-12 12:25
> ...
> , with 1-minute interval.
>
> I have now read it as Character in SAS dataset. Could anyone give me a
> hint as to the best way to convert it to SAS Datetime?
>
> Many thanks.
>
> Julie
>
From: LV Subbu on
Hi, is there an equivalent format to convert SASDateTime->ASCII DateTime?



On 11/23/07, data _null_, <datanull(a)gmail.com> wrote:
>
> 150 data _null_;
> 151 input ymddttm $16.;
> 152 sasDTTM = input(ymddttm,ymddttm.);
> 153 put (_all_)(=);
> 154 format sas: datetime13.;
> 155 cards;
>
> ymddttm=2006-01-12 12:24 sasDTTM=12JAN06:12:24
> ymddttm=2006-01-12 12:25 sasDTTM=12JAN06:12:25
>
>
> This assumes that the datepart is YYYY-MM-DD.
>
>
> On Nov 22, 2007 10:17 AM, Li,Qian [Ontario] <Qian.Li(a)ec.gc.ca> wrote:
> > Hello everyone,
> >
> > I have a question regarding converting ASCII data_time into SAS format.
> > For example, the format in ASCII file is:
> > 2006-01-12 12:24
> > 2006-01-12 12:25
> > ...
> > , with 1-minute interval.
> >
> > I have now read it as Character in SAS dataset. Could anyone give me a
> > hint as to the best way to convert it to SAS Datetime?
> >
> > Many thanks.
> >
> > Julie
> >
>
From: RolandRB on
On 25 Nov, 07:56, lvsub...(a)GMAIL.COM (LV Subbu) wrote:
> Hi, is there an equivalent format to convert SASDateTime->ASCII DateTime?

1 data _null_;
2 x=datetime();
3 put x=datetime20.;
4 run;

x=25NOV2007:09:05:56

From: "data _null_," on
When the SAS date time values is written out in any format that could
probably be considered ASCII Date time.
The IS8601dt format produces result very similar to the input. There
may be a format that produces an exact match but I don't know it. You
can format SAS dates and date times any way you like using proc format
PICTURE combined with the directives for dates and times.

1 data _null_;
2 input ymddttm $16.;
3 sasDTTM = input(ymddttm,ymddttm.);
4 put (_all_)(=);
5 format sas: is8601dt.;
6 list;
7 cards;

ymddttm=2006-01-12 12:24 sasDTTM=2006-01-12T12:24:00
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+-
8 2006-01-12 12:24
ymddttm=2006-01-12 12:25 sasDTTM=2006-01-12T12:25:00
9 2006-01-12 12:25


On Nov 25, 2007 12:56 AM, LV Subbu <lvsubboo(a)gmail.com> wrote:
> Hi, is there an equivalent format to convert SASDateTime->ASCII DateTime?
>
>
>
>
> On 11/23/07, data _null_, <datanull(a)gmail.com> wrote:
> > 150 data _null_;
> > 151 input ymddttm $16.;
> > 152 sasDTTM = input(ymddttm,ymddttm.);
> > 153 put (_all_)(=);
> > 154 format sas: datetime13.;
> > 155 cards;
> >
> > ymddttm=2006-01-12 12:24 sasDTTM=12JAN06:12:24
> > ymddttm=2006-01-12 12:25 sasDTTM=12JAN06:12:25
> >
> >
> > This assumes that the datepart is YYYY-MM-DD.
> >
> >
> > On Nov 22, 2007 10:17 AM, Li,Qian [Ontario] <Qian.Li(a)ec.gc.ca> wrote:
> > > Hello everyone,
> > >
> > > I have a question regarding converting ASCII data_time into SAS format.
> > > For example, the format in ASCII file is:
> > > 2006-01-12 12:24
> > > 2006-01-12 12:25
> > > ...
> > > , with 1-minute interval.
> > >
> > > I have now read it as Character in SAS dataset. Could anyone give me a
> > > hint as to the best way to convert it to SAS Datetime?
> > >
> > > Many thanks.
> > >
> > > Julie
> > >
> >
>
>
From: LV Subbu on
Hi, Thanks for your inputs.

I actually wanted to use date parameters in WHERE condition of an
SQL-passthru query
which expects datetime constant to be passed as {ts '2006-01-12 12:24'}

I did something like this..

%let etl_load_from_dttm=12-DEC-2006:12:24:00 ;

%let etl_load_from_dttm_odbc=%bquote({ts
'%sysfunc(tranwrd(%sysfunc(putn(%sysfunc(inputn(&etl_load_from_dttm,
datetime21.)),is8601dt.)),T,%str( )))'});



On 11/26/07, data _null_, <datanull(a)gmail.com> wrote:
>
> When the SAS date time values is written out in any format that could
> probably be considered ASCII Date time.
> The IS8601dt format produces result very similar to the input. There
> may be a format that produces an exact match but I don't know it. You
> can format SAS dates and date times any way you like using proc format
> PICTURE combined with the directives for dates and times.
>
> 1 data _null_;
> 2 input ymddttm $16.;
> 3 sasDTTM = input(ymddttm,ymddttm.);
> 4 put (_all_)(=);
> 5 format sas: is8601dt.;
> 6 list;
> 7 cards;
>
> ymddttm=2006-01-12 12:24 sasDTTM=2006-01-12T12:24:00
>
> RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+-
> 8 2006-01-12 12:24
> ymddttm=2006-01-12 12:25 sasDTTM=2006-01-12T12:25:00
> 9 2006-01-12 12:25
>
>
> On Nov 25, 2007 12:56 AM, LV Subbu <lvsubboo(a)gmail.com> wrote:
> > Hi, is there an equivalent format to convert SASDateTime->ASCII
> DateTime?
> >
> >
> >
> >
> > On 11/23/07, data _null_, <datanull(a)gmail.com> wrote:
> > > 150 data _null_;
> > > 151 input ymddttm $16.;
> > > 152 sasDTTM = input(ymddttm,ymddttm.);
> > > 153 put (_all_)(=);
> > > 154 format sas: datetime13.;
> > > 155 cards;
> > >
> > > ymddttm=2006-01-12 12:24 sasDTTM=12JAN06:12:24
> > > ymddttm=2006-01-12 12:25 sasDTTM=12JAN06:12:25
> > >
> > >
> > > This assumes that the datepart is YYYY-MM-DD.
> > >
> > >
> > > On Nov 22, 2007 10:17 AM, Li,Qian [Ontario] <Qian.Li(a)ec.gc.ca> wrote:
> > > > Hello everyone,
> > > >
> > > > I have a question regarding converting ASCII data_time into SAS
> format.
> > > > For example, the format in ASCII file is:
> > > > 2006-01-12 12:24
> > > > 2006-01-12 12:25
> > > > ...
> > > > , with 1-minute interval.
> > > >
> > > > I have now read it as Character in SAS dataset. Could anyone give me
> a
> > > > hint as to the best way to convert it to SAS Datetime?
> > > >
> > > > Many thanks.
> > > >
> > > > Julie
> > > >
> > >
> >
> >
>