Help using Base SAS procedures

Proc Export; Wrapping Column Names

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 83
Accepted Solution

Proc Export; Wrapping Column Names

I am running the following code:

proc export data=work.data

     outfile='C:\test.csv'

     dbms=csv replace;

     delimiter=';';

run;

The column names are pretty long and so it is wrapping the first row.  I do not want it to wrap.

Example of what is happening:

column1;column2;column3;column4;column5;

column6;column7

What I want:

column1;column2;column3;column4;column5;column6;column7

After the 99th character it begins to wrap.

Any help with this would be appreciated.


Accepted Solutions
Solution
‎01-22-2015 09:47 AM
Super User
Super User
Posts: 7,977

Re: Proc Export; Wrapping Column Names

How do you know it is wraping, have you opened it in a text editor perhaps?  Its most likely your text editor adding nice wrapping.  Open it with Excel and see if the columns are all correct.

Also, don't use proc export as it just guesses what you want, and so you can end up with problems.  Write a simple datastep with a file statement and put out your data, gives you more control.

View solution in original post


All Replies
Solution
‎01-22-2015 09:47 AM
Super User
Super User
Posts: 7,977

Re: Proc Export; Wrapping Column Names

How do you know it is wraping, have you opened it in a text editor perhaps?  Its most likely your text editor adding nice wrapping.  Open it with Excel and see if the columns are all correct.

Also, don't use proc export as it just guesses what you want, and so you can end up with problems.  Write a simple datastep with a file statement and put out your data, gives you more control.

Frequent Contributor
Posts: 83

Re: Proc Export; Wrapping Column Names

You are right.  When I open it with Notepad it displays the wrapping.  When I open it in excel it is on one row.

Super User
Super User
Posts: 7,977

Re: Proc Export; Wrapping Column Names

Yep, under Format action menu item there is an option for Word Wrap.  If you do get this and its not just the text editor, you can always check with a hex editor (plenty of free ones out there), and what you would see is 2 codes, 0a and 0d which are tab and line feed.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 624 views
  • 0 likes
  • 2 in conversation