BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
i making web log analysis and i want to sort page views per date. As we know, the date in weblog files has this format: 02JUN2006:00:00:00. I tried to create a new variable with only the day or date (eg. 02jun or 02jun2006) by truncating or new format, but it didnt work!!

thanks for your help

Jean-Sebastien
3 REPLIES 3
deleted_user
Not applicable
Jean-Sebastien,

You can apply one of the date formats in you data or sort step:

data _null_;
d='02jun2006:00:01:00'dt;
put d= datetime. / d= datetime9. / d= dtdate9.;
run;
deleted_user
Not applicable
THANKS nori, it worked!
deleted_user
Not applicable
Another option is the datepart function which will return a date sequence.


data _null_;

datetime_var = '07jun2006:01:05:06'dt;

date_var = datepart(datetime_var);

format datetime_var datetime20. date_var date9.;

put _all_;

run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2187 views
  • 0 likes
  • 1 in conversation