BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi all,

I'm using proc export to get some data into excel. I was wondering if someone knows of a way to export the fields in a specified order.
I'm trying to cut some post sas time.

Thanx
4 REPLIES 4
deleted_user
Not applicable
either change your data set to have columns in the order you prefer, or don't use proc export.

(I would recommend the latter)

Instead of proc export use:
ods listing close ;
ods csv file= 'this.csv' ;
proc print data= this_data noobs ;
var required columns in the preferred order ;
run;
ods csv close ;
ods listing ;
OK, it just creates the data in a form (very) ready for excel, but would something else achieve what you really need, as simply ?

Good Luck
Peter
deleted_user
Not applicable
PeterC,

In your response you said:

"either change your data set to have columns in the order you prefer ..."

I had some code a long time ago that would do this but it is now lost. How do you change the data set to have columns in order of my preference? I think the code I had was able to change the position attribute of variables. Searching SAS help hasn't led me to any methods that will do this.

Thanks for any help.
deleted_user
Not applicable
LJ

in another forum this would be more appropriate

or call customer support, or contact them online at
http://support.sas.com/techsup/contact/submit_emits2.html

it should be on a FAQ

"or just use retain"

or better still, please explain why internal order has any relevance to all users of the data table,

but
please do that in another forum

ODS and base SAS Reporting have many ways to help you select the required order. They just have no way of knowing the order you are going to need next. I see only simplicity in the current scheme - when reporting you specify the column order you want. I see only disappointment in preparing "column order", for later, or for someone-else.

In another forum your topic appears frequently.

Here is a link to one I recall :
http://tinyurl.com/f9ku9

PeterC
deleted_user
Not applicable
PeterC,

> in another forum this would be more appropriate

I see that the Integration with MS Office is a more appropriate forum. Thanks.

> or better still, please explain why internal order has any relevance to all users of the data table,

For exactly the same reason given by SAS coder.

Thanks very much for your reply.

LJ

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 2302 views
  • 0 likes
  • 1 in conversation