Date: Wed, 21 Jul 2010 12:53:32 -0700
Reply-To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject: Re: Regarding date time values
In-Reply-To: <201007211925.o6LAovai003495@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=utf-8
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Titaan Titaan
> Sent: Wednesday, July 21, 2010 12:26 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Regarding date time values
>
> Hi all,
> I am unable to get SAS ISO 8601 date time values. I have 2 data sets.
> One
> has SAS date with ISO format. It won't have time value. But another
> data
> set has both date and time values(2 separate variables) with $10 and $5
> formats. I need to set(stack) these data sets and to get only one date
> time
> variable with ISO format. Please help me in this regard.
> Thank you.
You need to tell us a little more about your data. Can you provide an example of you date in the first dataset and examples of date and time strings from your second dataset? An outline of what to do would be something like
Data want;
Set data1(in=in_1) data(in=in_2);
If in_1 then datetime = dhms(date1,0,0,0);
If in_2 then datetime = dhms(input(date2,some_format.,0,0,input(time2, time_format.));
Run;
What formats to use depend on your data. So give us some examples if you need more help.
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
|