'SAS: Converting the date format from yymmdd10. to date9
I have a sas dataset with a column called "date" in the format of yymmdd10., such as 2022-05-24.
I tried to covert it into the format of date9. as below, but it returns missing.
data want;
set have;
date1 = input(date,yymmdd10.);
format date1 date9.
run;
So I'd like to know what is the right code. Thanks!
Solution 1:[1]
Modify the appearance of the date in the data set without recreating the data set using PROC DATASETS.
title 'Initial format';
proc print data=have(obs=5);
var date;
run;
*modify format;
proc datasets lib=work nodetails nolist;
modify have;
format date date9.;
run;quit;
title 'New format';
proc print data=have(obs=5);
var date;
run;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Reeza |
