Data Question;
Date_Time_Variable = Dhms('03JUN22'd,00,00,00);
format Date_Time_Variable datetime. ;
run;
/* YOU CAN USE THIS COUSTOM FORMAT FOR MONTHS*/
Proc Format;
value MonthName 1 = "JAN"
2 = "FEB"
3 = "MAR"
4 = "APR"
5 = "MAY"
6 = "JUN"
7 = "JUL"
8 = "AUG"
9 = "SEP"
10= "OCT"
11= "NOV"
12= "DEC"
;
run;
Data Answer;
set Question;
*Extract Date from Date_Time_Variable;
Date = DatePart(Date_Time_Variable);
*Extracting Month From Date using Month Function that will return corresponding month number (1 - 12);
MonthNumber = Month(Date);
*Creating another variable Month that will use the above created Format;
Month = put(MonthNumber,MonthName.);
format date date9.;
run;
... View more