How to get a comma separated value in an excel report generated from running a SAS code

Reply
New Contributor
Posts: 3

How to get a comma separated value in an excel report generated from running a SAS code

How to get a comma separated value in an excel report generated from running a SAS code.

For Example  : Values generated in Excel are being displayed as 1234, 10567, 3478.

I need these values to be generated as 1,234 - 10,567 and 3,478 separated as commas. I used comma7.0, comma8.0 and comma9.0 format but the result is not being changed.

Please help

Super User
Posts: 10,500

Re: How to get a comma separated value in an excel report generated from running a SAS code

How are you getting the values into Excel? The method is likely to effect how to set the display in Excel or if it is even possible.

New Contributor
Posts: 3

Re: How to get a comma separated value in an excel report generated from running a SAS code

Thanks for the quick response buddy..

I use ODStagsets.excelxp and refer it to using file = ".xls path"

Any idea?

Super User
Posts: 10,500

Re: How to get a comma separated value in an excel report generated from running a SAS code

The solution is going to be the TAGATTR style attribute. There is an example setting Excel display formats in the Tagset documentation. You can get that by running

ods tagsets.excelxp options(doc='Help');

New Contributor
Posts: 3

Re: How to get a comma separated value in an excel report generated from running a SAS code

HI

OK. SO do you want me to try ODSTAGATTR..excelxp and refer it to the file=".xls path" to get the right format in getting the commas displayed?

Regards,

Adi

Super User
Posts: 17,837

Re: How to get a comma separated value in an excel report generated from running a SAS code

No, you need to tell Excel the format you want the data to have and you do that using tagattr style attributes.

See this paper from Cynthia Zender as a reference on how to get what you want and an explanation of how/why it works.

http://support.sas.com/resources/papers/proceedings11/266-2011.pdf

Ask a Question
Discussion stats
  • 5 replies
  • 310 views
  • 0 likes
  • 3 in conversation