BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10


data test(keep=ln_no,template);

set test2;

run;

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";

1 REPLY 1
Cynthia_sas
Diamond | Level 26

Hi:

 

  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:

https://communities.sas.com/message/55207#55207

https://communities.sas.com/message/152610#152610

  

cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1341 views
  • 0 likes
  • 2 in conversation