You are here:

SAS/SAS (convert date to a number)

Advertisement


Question
Hello,

How do I pick the month out of "today" and convert it to a 2-digit month number.   

%let today = %sysfunc( TODAY());


Thanks for your help.

Answer
Dear Carol,

I am sorry, could not reply earlier than today. I think you are looking for something like this

%let today = %sysfunc( TODAY());
%let Mymonth = %sysfunc(month(&today));

%put mymonth is >>&Mymonth;

%let Mymonth2digit = %sysfunc(putn(&Mymonth.,z2.));

%put mymonth 2digit is>>> &Mymonth2digit.;


Best Regards,
Arif  

SAS

All Answers


Answers by Expert:


Ask Experts

Volunteer


Ariful Mondal

Expertise

BASE SAS, SAS Macros, SAS Automation, SAS STAT, ANALYTICS PACKAGE, DDE, X-Commands, System Functions etc.

Experience

I have been using SAS for more than 7 years.

Organizations
MarketRx, Global Analytics, Morgan Stanley, HSBC

Education/Credentials
Masters in Applied Statistics and Informatics from IIT Bombay. Hons. in Statistics

©2016 About.com. All rights reserved.