Hello,
I have written below mentioned code for getting Month of Bonus from Hire date but in Month it shows only Jan, as hire date is starting on 1st of any month so its reading the date and showing as jan.the result output is attached for your reference.
FORMAT HIRE_DATE date9. BIRTH_DATE DDMMYY10.;*TO FORMAT DATE;
BonusMonth= month(Hire_Date);
format bonusmonth monname3.;
How do want it displayed? Like this?
BonusMonth = Hire_Date;
format BonusMonth monyy7.;
Your are applying format monname to a number that is a date value rather than a month value. So, upto 31 will ofcourse show as jan for the year 1960.
Try
proc format ;
value mn_name 1='January'
2='February'
3='March'
4='April'
5='May'
6='June'
7='July'
8='August'
9='September'
10='October'
11='November'
12='December'
other='Invalid';
run;
and apply:
format bonusmonth mn_name.;
Theres a MONNAME format you can use directly on the date.
Month = put(date, monname.);
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.