Gurus -
I want to pull only the month from the datasets. Currently the date is stored as example 12Aug2012. I just need Aug.
Thanks in advance.
Is the value a SAS date, i.e. numeric with a default format of Date9. or is it string?
If a SAS date then you can change the format Monname3. and it will display as Aug.
If need to select a specific month (not including year) of data you can use
if month(datevariablename) = 8; or the number of the month you want if the variable is a SAS date.
Is the value a SAS date, i.e. numeric with a default format of Date9. or is it string?
If a SAS date then you can change the format Monname3. and it will display as Aug.
If need to select a specific month (not including year) of data you can use
if month(datevariablename) = 8; or the number of the month you want if the variable is a SAS date.
Hi Ballarw -
If we are using proc sql example Select Month(xxxdate) gives me numeric "8", do you know how to change it to display "Aug".
Thanks
You can use
select month(xxxdate) as month format=NLSTRMON3.1, ...
this works for locale=English_UnitedStates, for other locales you must adjust the field width. For example, for locale=French_Canada, you must use NLSTRMON5.1 .
PG
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!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.