The SAS Output Delivery System and reporting techniques

Retain Leading zeros

Reply
Contributor
Posts: 58

Retain Leading zeros

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??
SAS Super FREQ
Posts: 8,868

Re: Retain Leading zeros

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
Ask a Question
Discussion stats
  • 1 reply
  • 132 views
  • 0 likes
  • 2 in conversation