Thursday, May 2, 2024
No menu items!
HomeData Analytics and VisualizationHow to Extract Date from DateTime in SAS

How to Extract Date from DateTime in SAS

This tutorial explains how to convert datetime to date in SAS, along with examples.

Let’s say you have a sample SAS dataset containing datetime values.

data mydata;
input date anydtdtm.;
datalines;
2024-01-29 05:04:43
2024-02-14 12:30:00
2024-03-01 18:45:30
;
run;

data newData;
set mydata;
date_yymmdd10=put(datepart(date), yymmdd10.);
date_mmddyy=put(datepart(date), mmddyy10.);
date_mmddyy2=put(datepart(date), mmddyyd10.);
date9=put(datepart(date), date9.);
date11=put(datepart(date), date11.);
proc print;
run;

To read this article in full, please click here

Read MoreListenData

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments