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 (May 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 14 May 2009 13:09:45 -0500
Reply-To:     Mary <mlhoward@AVALON.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mary <mlhoward@AVALON.NET>
Subject:      Re: Restructure dataset
Comments: To: tablenc <cuong01@GMAIL.COM>
Content-Type: text/plain; format=flowed; charset="Windows-1252";
              reply-type=response

Also, if you have many variables, see the thread:

Re: output question--one long row into many rows

on May 12th for more generalized solutions.

-Mary

----- Original Message ----- From: "Mary" <mlhoward@avalon.net> To: "tablenc" <cuong01@GMAIL.COM>; <SAS-L@LISTSERV.UGA.EDU> Sent: Thursday, May 14, 2009 1:05 PM Subject: Re: Restructure dataset

> data test; > infile cards missover; > input var1 var2 var3; > cards; > 40 40 32 > 38 41 37 > 34 47 29 > 44 37 34 > 50 62 22 > 59 34 28 > ; > run; > > data test2; > informat drugname $20. result 4.; > set test; > drugname='Placebo'; > result=var1; > output; > drugname='Aspirin'; > result=var2; > output; > drugname='Tylenol '; > result=var3; > output; > keep drugname result; > run; > > > -Mary > > > ----- Original Message ----- > From: "tablenc" <cuong01@GMAIL.COM> > To: <SAS-L@LISTSERV.UGA.EDU> > Sent: Thursday, May 14, 2009 12:35 PM > Subject: Restructure dataset > > >> I'm still learning about SAS, so sorry if the terminology I am using >> is off. I have this SAS dataset. >> >> 40 40 32 >> 38 41 37 >> 34 47 29 >> 44 37 34 >> 50 62 22 >> 59 34 28 >> >> The first column represents a placebo, the second one aspirin, and >> third is tylenol. >> I want to restructure this using array and the DO sequence. >> >> Is it possible for my dataset to look like this? >> >> The first column should represent 'type of dose' and the second column >> should represent amount. >> >> Placebo 40 >> placebo 38 >> placebo 34 >> and so on >> Aspirin 40 >> Aspirin 41 >> and so on >> Tylenol 32 >> Tylenol 37 >> and so on


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