DATA Step, Macro, Functions and more

how to get a month from date variable in variable

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

how to get a month from date variable in variable

Hello,

 

I want to know if i can get Month from date variable in a new variable.

 

Example -  I want to calculate 10% bonus on salary in the month of Hire Date.


Accepted Solutions
Solution
‎02-14-2018 11:01 AM
Super User
Super User
Posts: 9,193

Re: how to get a month from date variable in variable

Show examples in the form of a datastep in future, I will guess what you have:

data want;
  mydate="01FEB2017"d;
  month=month(mydate);
  format mydate date9.
         month monname3.;
run;

View solution in original post


All Replies
Solution
‎02-14-2018 11:01 AM
Super User
Super User
Posts: 9,193

Re: how to get a month from date variable in variable

Show examples in the form of a datastep in future, I will guess what you have:

data want;
  mydate="01FEB2017"d;
  month=month(mydate);
  format mydate date9.
         month monname3.;
run;
Occasional Contributor
Posts: 13

Re: how to get a month from date variable in variable

Thanks a lot,sure next time i will provide in detail.

Occasional Contributor
Posts: 13

Re: how to get a month from date variable in variable

Thank you sure i will consider your suggestion.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 90 views
  • 1 like
  • 2 in conversation