BookmarkSubscribeRSS Feed
Lost_Gary
Quartz | Level 8

I am trying to do a proc print (via ODS to Excel) with 0% as the value.  When the value pushes to Excel it just shows as % with no zero.  Is there a format or force function that I can use to force that % to show as 0%?  I have tried these combos:

 

Proc print Data=Garysdata;

var percentage ; /* this is where my table already has the value formatted as a percent */

var percentage / style ={tagarttr=format:0.0%} ;  /*this seems to have no additional affect */

run;

 

thanks in advance for any ideas.

2 REPLIES 2
ghosh
Barite | Level 11

try a custom format?  if that does not work, convert the number into text with a % suffix first

proc format;
 picture pct low - high= '009.9 %';
run;
Cynthia_sas
Diamond | Level 26

Hi:

  I see some problems with your TAGATTR attribute (wrong spelling, attribute value not quoted). This works for me:

Cynthia_sas_0-1593800443366.png

Plus, you did not say what destination you were using. I used ODS EXCEL, but you might have used ODS TAGSETS.EXCELXP, ODS CSV or even ODS HTML all of which might or might not use your TAGATTR value.

 

I suspect your TAGATTR didn't work because you didn't specify it correctly, if you posted exactly what you submitted. The attribute is TAGATTR, not TAGARTTR.

 

Also, ODS EXCEL respected my SAS format, without needing TAGATTR at all. However, that is not true of other destinations, which is another reason why seeing all your code would have been useful.

 

My data was not multiplied by 100 because I know that both PERCENT9.2 and my TAGATTR will multiply by 100.  If your number is already a percent, or you've already multiplied by 100, then you need to use a different technique, as shown below:

 

Cynthia_sas_1-1593802093266.png

 

Hope this points you to a solution with your data and your destination.

Cynthia

 

 

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1801 views
  • 1 like
  • 3 in conversation