Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

New variable for date

Regular Contributor
Posts: 218

New variable for date

Hi All,

I want to create a date column (Date_recored) in my output dataset (have) and assign all observations as 01JAN2015 which is a date value.


The following code that I wrote create column which is $9., but I want the column as Date9.


Can someone help please.



Data want;
set have;
Date_recored ='01JAN2015';

Super User
Posts: 5,504

Re: New variable for date

Marginally faster to eliminate the assignment statement ... other than that you're just missing a letter:


retain Date_recored "01Jan2015"d;

format date_recored date9.;

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation