LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 19 Feb 2008 20:47:12 -0500
Reply-To:   Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:   Re: data step
Comments:   To: Ashley Sanders <asanders@UFL.EDU>
Content-Type:   text/plain; charset=ISO-8859-1

Ashley,

1. Why would one want to change the order of a SAS dataset?

While I can't answer from a programming perspective, I definitely can from an analytical perspective.

If one knows the order of their variables, they can easily indicate what they want in a var statement (e.g., varx-whatusedtobefirstvar).

Similarly, if one is importing their SAS files to other software (e.g., SPSS or R), often the order of variables is extremely important to their future use.

2. SAS, and most SAS users I've ever known, have always considered variable order unimportant.

3. I have found using the Excel libname much more effective (sometimes) than attempting a solution via ODS. A good example was the recent thread: http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0802b&L=sas-l&D=1&O=A&P=15595 or, if that happens to wrap, http://xrl.us/bf77r .

HTH, Art ---------- On Tue, 19 Feb 2008 12:01:08 -0500, Ashley Sanders <asanders@UFL.EDU> wrote:

>I was watching the spin off about retain with interest, but had lost sight >of the original question about exporting to Excel. I kept trying to figure >out why it would be important to reorder the variables in a dataset. Now I >have two questions for the list: > >What other reasons are there for actually changing the 'order' of variables >in a dataset? >Since export to Excel is one time when order of variable handling could be >extremely important, why is it the one place you can't just specify the >order you want in the Export or other file-handling proc? --given, you could >output a csv or some other type of Excel-readable format with a number of >procedures that would let you order anyway you want. What would you really >give up if you used ODS to output a file for instance (i.e. what can that >export with excel engine do that other ways can't)? --I guess that's 3 >questions... > >>>-----Original Message----- >>>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >>>Gerhard Hellriegel >>>Sent: Tuesday, February 19, 2008 11:49 AM >>>To: SAS-L@LISTSERV.UGA.EDU >>>Subject: Re: data step >>> >>>you can also try to change the order of the variables: >>> >>>data test; >>> retain fname lname; >>> set test; >>>run; >>> >>>if that is exported in wrong order, try >>> >>> retain lname fname; >>> >>>don't know what PROC EXPORT is doing. From left to right or from right >>>to >>>left? >>> >>>Gerhard >>> >>> >>> >>>On Tue, 19 Feb 2008 11:19:04 +0800, Hu, Jiangtang >>><jiangtanghu@GMAIL.COM> >>>wrote: >>> >>>>proc sql may help you. Like this: >>>> >>>>data a; >>>> input lname$ fname$; >>>> cards; >>>> lname1 fname1 >>>> lname2 fname2 >>>> ; >>>>run; >>>> >>>>*proc sql; >>>> create table c as >>>> select fname, lname >>>> from a; >>>>quit;* >>>> >>>>proc export data=c >>>> outfile="d:\c.xls" >>>> dbms=excel replace; >>>>run; >>>> >>>>On Feb 19, 2008 10:55 AM, Miguel de la Hoz <miguel_hoz@yahoo.es> >>>wrote: >>>> >>>>> I am starting my problem with the following disposal of my dataset: >>>>> >>>>> # variable >>>>> 1 lname >>>>> 2 fname >>>>> >>>>> I am trying to export it to excel but it is keeping that order. I >>>would >>>>> like to be able to write >>>>> >>>>> # variable >>>>> 1 fname >>>>> 2 lname >>>>> >>>>> This is only an example my dataset contains around 20 fields. >>>>> >>>>> Thanks. >>>>> >>>>> MDH. >>>>> >>>>> >>>>> >>>>> ______________________________________________ >>>>> ?Con Mascota por primera vez? Sé µn mejor Amigo. Entra en Yahoo! >>>>> Respuestas http://es.answers.yahoo.com/info/welcome >>>>> >>>> >>>> >>>> >>>>-- >>>>Jiangtang Hu >>>>Peking University


Back to: Top of message | Previous page | Main SAS-L page