From: Nathaniel Wooding on 25 Feb 2010 09:35 Craig I usually use Proc Transpose. Nat Wooding -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Craig Johnson Sent: Thursday, February 25, 2010 9:30 AM To: SAS-L(a)LISTSERV.UGA.EDU Subject: Unstacking Data A lot of the data I work with is longitudinal data that is stacked. Before analysis, I have to unstack it and re-label variables with a suffix to indicate time of collection. I've used proc transpose, data steps, and a basic macro to unstack the data. I thought I'd ask the experts what their common methods of unstacking data was. 1) Code it using proc transpose 2) Data steps and merge all the sections together 3) Custom macro (automates proc transpose) 4) A method in PROC SQL I'm not aware of? Any advice to make the task easier would be appreciated! Thanks! CONFIDENTIALITY NOTICE: This electronic message contains information which may be legally confidential and or privileged and does not in any case represent a firm ENERGY COMMODITY bid or offer relating thereto which binds the sender without an additional express written confirmation to that effect. The information is intended solely for the individual or entity named above and access by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.
From: "Data _null_;" on 25 Feb 2010 10:37 It might be good to be more specific about your needs. Do you flip one variable or many? Do you flip both data types? Amount of data etc. The answer to these question can often determine the "best" approach. I usually tend to like PROC TRANSPOSE for a tall to wide flip, because it can create and unknown number of variables and provide variable names and labels for them using data from the transpose dataset. On 2/25/10, Craig Johnson <cjohns38(a)gmail.com> wrote: > A lot of the data I work with is longitudinal data that is stacked. Before > analysis, I have to unstack it and re-label variables with a suffix to > indicate time of collection. I�ve used proc transpose, data steps, and a > basic macro to unstack the data. I thought I�d ask the experts what their > common methods of unstacking data was. > > > > 1) Code it using proc transpose > > 2) Data steps and merge all the sections together > > 3) Custom macro (automates proc transpose) > > 4) A method in PROC SQL I�m not aware of? > > > > Any advice to make the task easier would be appreciated! > > > Thanks! >
From: rjf2 on 25 Feb 2010 14:40 > From: Craig Johnson > Sent: Thursday, February 25, 2010 9:30 AM > To: SAS-L(a)LISTSERV.UGA.EDU > Subject: Unstacking Data > A lot of the data I work with is longitudinal data that is stacked. Before > analysis, I have to unstack it and re-label variables with a suffix to > indicate time of collection. I've used proc transpose, data steps, and a > basic macro to unstack the data. I thought I'd ask the experts what their > common methods of unstacking data was. > 1) Code it using proc transpose > 2) Data steps and merge all the sections together > 3) Custom macro (automates proc transpose) > 4) A method in PROC SQL I'm not aware of? > Any advice to make the task easier would be appreciated! > Thanks! Advice: Know Thy Data. Before I realized the power of transpose, I did a lot of data step wide-to-tall with arrays. At the time this made sense to me because I had to convert (look up) sample numbers to sample ids and the reference laboratory (standard==true) result to compare with the laboratory result. Much later I took the time to dig deeper into the esoteric power of proc transpose. I like it and wonder how much data I did not process with my earlier array processing. What I like: relabeling of variables with values This is how I know I still have some (at least one instance of) earlier versions of SAS still around. Ron Fehd the former array Now proc transpose maven
|
Pages: 1 Prev: dsread - Windows command-line utility for SAS7BDAT files Next: Unstacking Data |