Desktop productivity for business analysts and programmers

transforming a character date into a sas date using %sysfunc

Reply
Frequent Contributor
Posts: 111

transforming a character date into a sas date using %sysfunc

Hello,

 

I would like to transform a date into numerical value 

Here's my code

 

%let date1='01jan2017'd;

%let date2=%sysfunc(????(&date1),????);

%put &date2;

 

&date2=20820;

PROC Star
Posts: 8,117

Re: transforming a character date into a sas date using %sysfunc

I think you are looking for:

%let date1='01jan2017'd;
%let date2=%sysevalf(&date1);

%put &date2;

Art, CEO, AnalystFinder.com

 

Frequent Contributor
Posts: 111

Re: transforming a character date into a sas date using %sysfunc

Good morning,

 

It is exactly what I was looking for.  

Thanks a lot for your help.

 

Alain

Super User
Posts: 10,626

Re: transforming a character date into a sas date using %sysfunc

%let date1=01jan2017;
%let num=%sysfunc(inputn(&date1,date9.));
%put &num ;
Ask a Question
Discussion stats
  • 3 replies
  • 366 views
  • 5 likes
  • 3 in conversation