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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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