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
SAS Super FREQ
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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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