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 (December 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 12 Dec 2006 15:08:15 +0800
Reply-To:   VORA Mihir <VORAM@ESSILOR.COM.SG>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   VORA Mihir <VORAM@ESSILOR.COM.SG>
Subject:   Re: Transpose columns to rows in SAS?
Comments:   To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Content-Type:   text/plain

To add a few statistics to Howard's code:

I tested the same code on my machine and it got completed in 7.45 seconds (log lines given below). It took a few minutes to open the new transposed table however it did open correctly. Howard, I guess it failed to open for you due to some RAM issues? Not sure if I am right on this.

NOTE: There were 100000 observations read from the data set WORK.LONG. NOTE: The data set WORK.WIDE has 101 observations and 100001 variables. NOTE: PROCEDURE TRANSPOSE used (Total process time): real time 7.45 seconds cpu time 1.91 seconds

Regards, Mihir Vora

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Howard Schreier <hs AT dc-sug DOT org> Sent: Tuesday, December 12, 2006 12:33 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Transpose columns to rows in SAS?

On Mon, 11 Dec 2006 18:04:35 -0800, Wei ZOU <wzou@UCDAVIS.EDU> wrote:

>Thank you very much, Atul. I will run the code and feed back to you the >results. After transposing, I may have 100,000 variables but 100 cases. >Not sure if SAS can handle this kind of dataset.

It can, but such an extremely wide data set is likely to be awkward for just about any imaginable purpose. I just ran a test:

data long; do id = 1 to 1e5; retain v1-v100 0; output; end; run;

proc transpose data=long out=wide; id id; var v1-v100; run;

It completed in a few seconds, but now it took forever trying to bring WIDE up in VIEWTABLE, then failed. That's what you can expect.

If you explain your actual purpose, I suspect that somebody will be able to suggest an approach which avoids this step.

> >Best regards, > >Wei > >Aqua_cool_dude wrote: >> Hi, >> Try this and lemme know if it works: >> >> proc transpose data=<dataset-name> out=<output-name> PREFIX=var; >> ID id; >> Var Time Height; >> Run; >> >> Its quite basic...i can enhance it if u need it... >> >> Regs, >> Atul >> Wei ZOU wrote: >>> Hello, all: >>> >>> I am trying to change my data columns to data rows, i.e., variables <-> >>> cases. In Excel it is called "transpose". Since My data set is big, >>> Excel cannot process it. Could you please tell me if I can do this using >>> SAS Transpose in Analyst or code? >>> >>> An illustration of my original data set: >>> id time height >>> 1 100 1011 >>> 2 200 111 >>> 3 300 4222 >>> 4 400 3502 >>> 5 500 100 >>> 6 600 300 >>> >>> I want to transpose it to >>> var1 var2 var3 var4 var5 var6 >>> time >>> height >>> >>> Thanks a lot in advance. >>> >>> >>> Best regards, >>> >>> Wei >>


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