First some details you need to provide.
Are your original Day and Month variables character or numeric?
Second you define the format to use values 1 through 12 but then apply them to a value Daymonth that you think is "12-1". Since you do not have the value "12-1" in the format it does not get applied and the value is likely shown. But depending on the format when you create DayMonth you likely have values with spaces due to using the || operator.
Example:
data example;
day=1;
month=12;
daymonth = month||'-'||day;
run;
Which will have an actual value (pasting into a text box because the forum will reformat the text to much shorter)
Daymonth=" 12- 1"
because the default format for numeric variables as I created that is BEST12 and the conversion to character that takes place using the || operator uses the default format and right justifies the result. So there are LOTS of spaces, 10 before the 12 and 11 before the 1.
Here is a large economy sized hint: when storing any value that might resemble a date then create an actual date with a year month and day of the month. Then you can create formats that will work a bit more consistently.
To create a format that would display "12-1" "12-2" ... "12-31" you would have to list each value to display December. Ranges work oddly if you try to use them with character values. I'll leave this as an exercise for the interested reader.
Another issue is what can happen using character formats with undefined values and default display lengths. Using your format and the data I created above:
proc print data=example;
title "Simple format use $charmonth.";
format daymonth $charmonth.;
run; title;
proc print data=example;
title "use $charmonth20.";
format daymonth $charmonth20.;
run; title;
You will see that Daymonth does not appear to be in the first proc print output and only appears partially in the second. Using an explicit width with the format, such as $charmonth20. it will force displaying up to 20 characters if available. Since there are lots of spaces between the - and the 1 for days that still isn't wide enough. Sometimes when creating format you need to specify a default display length as well. Follows an example with a date type numeric value and format with directives to display month and day. SAS supplies a format MONNAME that will display any date just as the name, but you do need a complete date value to use it.
data example2;
day=1;
month=12;
date = mdy(12,1,1960);
run;
proc format;
picture Month_day (default=15)
low-high = '%B-%d' (datatype=date)
;
proc print data=example2;
format date month_day.;
run;
https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354 has a PDF with much information about dates.
... View more