The SAS Output Delivery System and reporting techniques

proc tabulate: keep leading zeros in excel

Accepted Solution Solved
Reply
Contributor
Posts: 43
Accepted Solution

proc tabulate: keep leading zeros in excel

Hello everybody,

I have to send some output to excel with a string with leading zeros through ods tagsets.excelxp.

In Proc print I just use

proc print data=x ;

var stringwithzeros /style=[tagattr="000000000000"];

run;

but I cannot find a way to do it in a proc freq or proc tabulate.

for instance how can I do it in code like this;

proc tabulate data=x ;

class stringwithzeros ;

tables stringwithzeros all, colpctn;

run;

thank you very much in advance

ciro


Accepted Solutions
Solution
‎09-22-2011 12:11 PM
Contributor
Posts: 43

proc tabulate: keep leading zeros in excel

thank you again art for the reference.

the solution should be this:

proc tabulate data=x ;

class stringwithzeros ;

classlev stringwithzeros /style=[tagattr="000000000000"];

tables stringwithzeros all, colpctn;

run;

thanks to cinthia for the "colorful" post at

http://communities.sas.com/message/36683#36683

View solution in original post


All Replies
PROC Star
Posts: 7,363

proc tabulate: keep leading zeros in excel

Can you accomplish what you want by adding a format statement using the z format?  e.g.,

proc tabulate data=sashelp.class ;

  keylabel n='No.' all='Total' ;

  class age sex ;

  format age z10.;

  table (age all)*f=3. , sex* pctn<age all>*f=4. ;

run;

Contributor
Posts: 43

proc tabulate: keep leading zeros in excel

thank you for the quick reply. the problem is the variable I'm tryng to export is character with all the leading zeros.

It is just the passage to excel that drop them down

PROC Star
Posts: 7,363

proc tabulate: keep leading zeros in excel

Solution
‎09-22-2011 12:11 PM
Contributor
Posts: 43

proc tabulate: keep leading zeros in excel

thank you again art for the reference.

the solution should be this:

proc tabulate data=x ;

class stringwithzeros ;

classlev stringwithzeros /style=[tagattr="000000000000"];

tables stringwithzeros all, colpctn;

run;

thanks to cinthia for the "colorful" post at

http://communities.sas.com/message/36683#36683

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 848 views
  • 0 likes
  • 2 in conversation