BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ciro
Quartz | Level 8

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

1 ACCEPTED SOLUTION

Accepted Solutions
ciro
Quartz | Level 8

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

4 REPLIES 4
art297
Opal | Level 21

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;

ciro
Quartz | Level 8

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

ciro
Quartz | Level 8

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

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
  • 4 replies
  • 2122 views
  • 0 likes
  • 2 in conversation