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;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 2248 views
  • 0 likes
  • 1 in conversation