Hi:
If you make a PICTURE format and use a DATE "directive", you can insert the hyphens into any kind of date format you want to design. Some of the SAS formats allow you to specify a separator, but the DATE7 and DATE9 formats don't fall into that category.
In this program, I have a PROC FORMAT that sets up the special date PICTURE format and then my PROC PRINT uses the format -- and shows some other formats by way of comparison.
If you need more help using PROC FORMAT for setting a PICTURE format, I recommend that you start with this SUGI paper:
http://www2.sas.com/proceedings/sugi31/243-31.pdf or contact Tech Support.
cynthia
[pre]
*** the code;
** first make some test data;
data testdate;
length name $20;
infile datalines dsd;
input name $ bdate : date9.;
bdate1 = bdate;
bdate2 = bdate;
bdate3 = bdate;
bdate4 = bdate;
bdate5 = bdate;
bdate6 = bdate;
return;
datalines;
"Sam Waterston",15NOV1940
"Petula Clark",15NOV1932
"Liv Tyler",01JUL1977
"Emilio Estevez",12MAY1962
;
run;
** using date directives to make a picture format;
proc format;
picture bd low-high='%0d-%b-%y' (datatype=date);
picture bd_alt low-high = '%0d-%b-%Y%y' (datatype=date);
run;
** formatting date multiple ways;
proc print data=testdate label;
title 'Show Biz Bdays';
label bdate = 'Internal Number for Date'
bdate1 = 'Used DATE7. format'
bdate2 = 'Picture Format Dashes, 2-digit year'
bdate3 = 'Picture Format Dashes, 4-digit year'
bdate4 = 'Used DATE9. format'
bdate5 = 'Used MMDDYY10. format'
bdate6 = 'Used ddmmyyd11. format';
format bdate1 date7. bdate2 bd. bdate3 bd_alt.
bdate4 date9. bdate5 mmddyy10. bdate6 ddmmyyd10.;
run;
[/pre]