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 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 25 Feb 2010 12:57:55 -0800
Reply-To:     "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject:      Re: How to transpose a table
In-Reply-To:  <hm6egi$rgi$1@adenine.netfront.net>
Content-Type: text/plain; charset="us-ascii"

In a data step Define a character array containing the six car: variables Read a record populating serial number and the six car: variables Loop through the array Set quarter equal to the variable name of this array element Set car equal to the value of the array element Write the result to your SAS data set End loop End data step

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Jinto83 Sent: Thursday, February 25, 2010 10:12 AM To: SAS-L@LISTSERV.UGA.EDU Subject: How to transpose a table

Hi Suppose I have a inputfile like this:

serialnumber car1994q1 car1994q2 car1994q3 car1994q4 car1995q1 car1996q2 1 toyota ford gm gm honda toyota 2 bmw bmw bmw bmw bmw vw

How do I transform it into a narrow column like structure like this:

outputfile: serialnumber quarter car 1 1994q1 toyota 1 1994q2 ford 1 1994q3 gm 1 1994q4 gm 1 1995q1 honda 1 1996q2 honda 2 1994q1 bmw 2 1994q2 bmw 2 1994q3 bmw 2 1994q4 bmw 2 1995q1 bmw 2 1996q2 vw


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