DATA Step, Macro, Functions and more

Create a date variable in a sas dataset

Reply
Occasional Contributor
Posts: 13

Create a date variable in a sas dataset

[ Edited ]

Hi, 

 

I have some trouble cause i would like to create a date variable dat in a sas dataset and i'm doing lke this:

 


%let date_traitement=%sysfunc(intnx(month, %sysfunc(today()),-1,e), ddmmyyn8.);
%put NOTE: DATE de Traitement ====> &date_traitement.;
data test;
	set sashelp.Prdsal2;
	date0= put(input(&date_traitement.,ddmmyy10.), ddmmyy10.);
run;

 

Dateset is created but the variable dat have values 3101202 instead of 31012018. I'm a bit confused.

 

Thnaks for your support

 

 

Super Contributor
Posts: 344

Re: Create a date variable in a sas dataset

Try put &date between quotes:

 

"&date_traitement."

 

//Fredrik

Ask a Question
Discussion stats
  • 1 reply
  • 82 views
  • 0 likes
  • 2 in conversation