BookmarkSubscribeRSS Feed
lloraine
Calcite | Level 5
I have the following code:
ods html file='N:\admin\Linda\SAS\TESTCounties.xls' style=minimal;
proc print data=Linda.AssocCnty label;
var CL_N CL_Nm REGION AssocNumeric;
label CL_N ='CL N'
CL_Nm = 'CL Nm';

run;
ods _all_ close;
ods listing;

I would like to retain leading zeros.
I found the following on this site but do not know where to put it.
I've retained leading zeroes for Excel output via ODS HTML using

... htmlstyle='vnd.ms-excel.numberformat:@' ...

Can someone please tell me where to put it in the above code. If not there - where??
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
Let's say that your variable CL_N is what you want with leading zeroes, then you would have 2 VAR statements:

[pre]
var CL_N / style(data)={htmlstyle="....."};
var CL_Nm REGION AssocNumeric;
[/pre]

The STYLE(DATA) override option allows ODS to pass the HTML style for CL_N (only) into the HTML that's being generated for the output file. The other VAR statement just lists the rest of the variables you want on the report.

cynthia

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 935 views
  • 0 likes
  • 2 in conversation