BookmarkSubscribeRSS Feed
polpel
Fluorite | Level 6

Hello,

I've come accross a very annoying problem when exporting a table to Excel using ODS.

Basically I have a column where two strings are longer than the rest of the strings, and contain two words separated by a space ("Current Medicine" and "Consultations Visits").

When I export to Excel, these to variables are no longer separate by a space but by a return so I get:

 

Current

Medicine

 

Consultations

Visits

 

These are still in the same cell but it's still annoying because the stuff in which I use these tables in Excel needs it to be on the same line.

 

I hope this was clear, it wasn't very easy to explain...

Thanks in advance,

 

Regards

3 REPLIES 3
andreas_lds
Jade | Level 19

Posting data and the code you used to export the file will help us finding a solution.

Tom
Super User Tom
Super User

ODS is trying to make your print out look pretty.  It is a printing utility and not a data transfer utility.

You have two options.  

First is to switch to using LIBNAME or PROC EXPORT to generate your Excel file as a straight data transfer.

Second is to search for the option they added to ODS EXCEL that lets you tell it that you don't want it to insert line breaks into long strings.  Once you find that option make sure you are using a recent enough version of SAS that it has been implemented in your version.

Ksharp
Super User

Try some style.

 

ods excel ...

proc report ....

.........

define xx / style={ tagattr="wrap:no"} ;

..........

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 429 views
  • 0 likes
  • 4 in conversation