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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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