02-01-2013 12:28 AM
format month monname3.;
Proc print data=test;
when i run this code, i get result like this...
its sud be like
& so on...
02-01-2013 12:39 AM
Format is applied on the date value.SAS Consider this numbers as date and output the month for the data. It consider it as dates of Jan1960.
02-01-2013 01:16 AM
its working on date part not with year.. if like 1 means 1st date of year n i will work till 365.like if i give 31st then it returns feb, but jan is a 31 days month. 60 give mar.
it cant b use with date.
so how can i use monname3.
02-01-2013 02:39 AM
jan belongs to 31 days...apart it my question is how can i use monname3. format?
there is a dataset name sashelp.prdsales. in that column name month having format monname3. plz check
02-01-2013 03:28 AM
From the documentation:
The common ground that SAS uses to represent dates is called a SAS date value. No matter which form you use to write a date, SAS can convert and store that date as the number of days between January 1, 1960, and the date that you enter.
The column "month" in sashelp.prdsales contains full date numbers, so if you change the format of "month" to date9. full dates are displayed.
proc print data=sashelp.prdsale;
format month date9.;
Using sas formats is the common way associating numbers with names/text.
02-01-2013 04:29 AM
MONNAME. formats a DATE, not a month number.
Monname format writes date values as name of the month,but your data don't have any date column.
If your data comes in the same format as you have mentioned then you can define user defined format and then apply on the month variable.
If you don't want to create User defined Format.Here is the Alternative.But i strongly recommend to use user defind format.
format month1 monname3.;
02-01-2013 05:08 AM
You can use below code..this is very easy to use ..
value mon 1 = JAN
2 = FEB
3 = MAR
4 = APR
5 = MAY
format month mon.;
08-06-2013 05:57 AM
The result is correct because the format monname3. only works with sas date value and not with the month value.
try this to see the difference:
put "&_month." ;
put "&_month2." ;
put "&_month3." ;