BookmarkSubscribeRSS Feed
KimLeBouton
Quartz | Level 8
I’m creating several pivot table reports using Chevell Parker’s SAS Global Forum 2010 paper, http://support.sas.com/resources/papers/proceedings10/003-2010.pdf.

My past history with leading zeros and tagsets doesn’t seem to be working this time.

I’ve tried the following within in my PROC PRINT, but it isn’t working.

var char_lead_zero / style(data)={tagattr="format:@"};

My current code follows my signature. The number_format, within the ODS statement, didn’t work either. I’m using SAS 9.13 SP 4.

TIA,
Kim LeBouton

data test;
input char_lead_zero $5. x year;
datalines;
01234 10 1999
02345 15 2000
12345 20 2001
;
run;

ods tagsets.tableeditor file="%sysfunc(getoption(work))\temp.html"
options(
/*button_text="Create PivotTable"*/
auto_excel="yes"
excel_open="yes"
pivotrow="char_lead_zero"
pivotcol="year"
pivotdata="x"

sheet_name="Test by Kim"
number_format="@"
excel_save_file="c:\\temp.xls"
quit="yes");

proc print data=work.test;
run;

ods tagsets.tableeditor close;
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
I don't know about using the @ in the format. However, when I need leading zeroes in an HTML file that will be opened by Excel, I use the mso-number-format with the HTMLSTYLE style attribute. You might want to double check with Tech Support that this is OK. When I ran this code, I did get leading zeroes in the file that Excel opened. I tried number_format="00000" first, by itself, but that did not cause leading zeroes. Only using the HTMLSTYLE style attribute worked.

cynthia
[pre]
ods tagsets.tableeditor file="c:\temp\temp.html"
options(auto_excel="yes"
excel_open="yes"
pivotrow="char_lead_zero"
pivotcol="year"
pivotdata="x"
sheet_name="Test by Kim"
number_format="00000"
excel_save_file="c:\temp\temp_save.xls"
quit="yes");

proc print data=work.test;
var char_lead_zero / style(data)={htmlstyle='mso-number-format:00000'};
var x year;
run;

ods tagsets.tableeditor close;


[/pre]

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