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

hi I have a table that divede one amt into another an it comes out with a decimal I need to add the % sign to the output

example

( sales/ inventory)as percentage_sales;

5/10. = 0.5   I need to read 50% ...thanks for your assistance in this matter

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

( sales/ inventory) as percentage_sales format=percent8.  ;

View solution in original post

7 REPLIES 7
Ksharp
Super User

( sales/ inventory) as percentage_sales format=percent8.  ;

BETO
Fluorite | Level 6

Xia Keshan,

It applied the symbol but when I export it was removed an reverted back to decimal ... How can I keep the symbol when it's exporting out to excel? Thanks

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Post example data in the forma of a datastep, and describe how you are exporting the data.  Generally speaking, I would be using the tagsets.excelxp and a proc report, so would just add the Excel format to the column:

http://support.sas.com/resources/papers/proceedings10/031-2010.pdf

But it depends on how your data is, and how you are exporting.

Ksharp
Super User

You'd better post it at ODS and REPORT forum, It looks like ODS problem , You need some special style like : style={tagattr="format:@"}

BETO
Fluorite | Level 6

I Have a table like this

a.no,

a.market,

(a.sales/a.inventory) as percent format= percent8.,

from want a left join table b. On a.no=b.no

);run;

Proc export data = want1

outfile= sharepoint

dbms=excel replace;

newfile=yes;

run;

BETO
Fluorite | Level 6

I converted it to character it works

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes, that will work.  I would recommend however you 1) don't use proc export, it is a guessing procedure, i.e. it guesses what you want to do. 2) use proc report and ods tagsets.excelxp, this has a lot more functionality, and you can set formats as per the link I gave you. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 7 replies
  • 2008 views
  • 4 likes
  • 3 in conversation