The SAS Output Delivery System and reporting techniques

Showing leading zeros and using Define in ODS

Regular Contributor
Posts: 179

Showing leading zeros and using Define in ODS

data test(keep=ln_no,template);

set test2;


sample output

ln_no                       template

0001444444             sample

0000000444            sample2

How can I display the ln_no to capture the leading zeros and show an actual 10 digit ln_no

DEFINE  ln_no  /Display style(column)={tagattr="format:????????" cellwidth=80pt just=right"Loan Number";

Posts: 9,373

Re: Showing leading zeros and using Define in ODS



  The TAGATTR style attribute method will ONLY work if you are using ODS TAGSETS.EXCELXP to create ODS output that can be opened in Excel. If you use HTML-based methods, and you want to open the HTML file with Excel, then you would use the HTMLSTYLE style attribute method. Otherwise, for other destinations, such as ODS HTML with a browser or ODS RTF or ODS PDF, you can simply use the Z10. SAS format to format the number with leading zeroes. The only application that does not respect the SAS Z. format is Excel, when it opens output.


  There have been many previous postings on the use of TAGATTR and/or HTMLSTYLE. Have you searched for any previous postings on the subject. Here are a few places to start:



Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation