Help using Base SAS procedures

How to get datepart from the data

Reply
Occasional Contributor
Posts: 17

How to get datepart from the data

Data new;
Input sdtime anydtdtm.;
Cards;
12:03:2003:12:13:23
;
Run;


I need a new variable with datepart...

Super User
Posts: 10,778

Re: How to get datepart from the data

Posted in reply to rajeshV89
options datestyle=mdy;
Data new;
Input sdtime anydtdtm32.;
date=datepart(sdtime);
format date date9. sdtime datetime.;
Cards;
12:03:2003:12:13:23
;
Run;
proc print;run;
Ask a Question
Discussion stats
  • 1 reply
  • 131 views
  • 0 likes
  • 2 in conversation