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-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!

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.

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