moiaussi06
moiaussi06

Reputation: 221

SQL Datetime Format Variable Convertion in SAS

When I tried to retrieve earliest and latest time stamp by cookie id. I got 1737527710 instead of 24JAN15:04:06:22. Can any one help me with the correct way of getting the desired time stamp information?

proc sql;
    create table travel.summary as
    select cookie, COUNT(id) as tot_count, SUM(response)as respond_flag, MIN(timestamp)as first_interaction, MAX(timestamp) as last_interaction
    from travel
    group by cookie;
quit;

Upvotes: 0

Views: 256

Answers (1)

SRSwift
SRSwift

Reputation: 1710

You are seeing the unformatted value (SAS datetimes are the number of seconds since 1960-01-01).

You can request that proc sql format your variable in the select statement like this:

min(timestamp) as first_interaction format = datetime.

Upvotes: 1

Related Questions