- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 01-29-2019 04:53 AM
(620 views)
Hi all,
I need to create to date variables with the following formate: date1=dd/mm/yy and date2=dd/mm/yy.
I have the following program and it doesn't work:
data example;
set dataset;
date1='01jan18'd;
date2='31dec18'd;
put date1 ddmmyy8.;
put date2 ddmmyy8.;
run;
The dates return in weird formats.
Hope someone can help!
Best,
Julie
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi. In the code you posted you only format the date variables in the date values you put to the log. The date variables in the data set will not be formatted. Use a Format Statement like this
data test;
date1='01jan18'd;
date2='31dec18'd;
format date1 date2 ddmmyy8.;
run;