LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (May 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 1 May 2003 15:09:57 -0400
Reply-To:     Nathaniel_Wooding@DOM.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nathaniel Wooding <Nathaniel_Wooding@DOM.COM>
Subject:      Re: problem in transposing
Comments: To: Archana Gowder <gowdar@advbiol.com>
Content-type: text/plain; charset=us-ascii

Sam

Here is a solution that provides unit as a variable in the new data set. without including it as a by variable. However, does this give you the proper value? Note the comments in the code.

Where a single unit appears in one of the sets, the value is transposed. However, if two lines have a value for unit, then you get an additional line of output. Is this what you need?

I, too, appreaciate your sending your code as you did.

Nat Wooding

DATA XX; INPUT CAT $2. PT 3. TEST $ 5. DAY 2. INVN $4. VAL $4. unit $4.; DATALINES; A 101 DIS1 1 LOP 1.2 A 101 DIS1 2 LOP 1 A 101 DIS1 3 LOP nd nd A 101 DIS2 1 DAN 1.1 A 101 DIS2 2 DAN 1.3 A 101 DIS2 3 DAN 1.2 we B 101 DIS3 1 DAN 1.1 B 101 DIS3 2 DAN 2 B 101 DIS3 3 DAN 3 B 101 DIS4 1 LOP 1.2 B 101 DIS4 2 LOP 1.5 B 101 DIS4 3 LOP nd nd C 101 DIS5 1 DAN 1 C 101 DIS5 2 DAN 2 C 101 DIS5 3 DAN 2 A 102 DIS1 1 LOP 1.2 qw A 102 DIS1 2 LOP 1 A 102 DIS1 3 LOP 1.2 A 102 DIS2 1 DAN 1.1 A 102 DIS2 2 DAN 1.3 A 102 DIS2 3 DAN 1.2 B 102 DIS3 1 DAN 1.1 B 102 DIS3 2 DAN 2 B 102 DIS3 3 DAN 3 B 102 DIS4 1 LOP 1.2 B 102 DIS4 2 LOP 1.5 B 102 DIS4 3 LOP 1.9 C 102 DIS5 1 DAN nd nd C 102 DIS5 2 DAN 2 er C 102 DIS5 3 DAN 2 ;

PROC SORT DATA = XX ; BY PT CAT TEST INVN descending unit;* change --note sort on descending unit;

proc print;

PROC TRANSPOSE DATA=XX OUT = T_XX; ID DAY; BY PT CAT TEST INVN ; copy unit; * change unit moved to this line; VAR VAL;

PROC PRINT DATA = T_XX; RUN;

"Archana Gowder" <gowdar@advbiol.c To: <Nathaniel_Wooding@dom.com> om> cc: Subject: Re: problem in transposing 05/01/03 02:38 PM

Hi, If i don't use variable in transposing ,like for example unit in my dataset then that data set does n't contain unit varaible .Unit variable is unavailable for further use.How can i use ,whats the solution.

Thank you ----- Original Message ----- From: <Nathaniel_Wooding@dom.com> To: "Sam" <gowdar@ADVBIOL.COM> Sent: Thursday, May 01, 2003 2:30 PM Subject: Re: problem in transposing

> > Sam > > I am not certain that I understand your problem but, if the following is an > example > > Obs PT CAT TEST INVN unit > _NAME_ _1 _2 _3 > > 1 101 A DIS1 LOP > VAL 1.2 1 > 2 101 A DIS1 LOP nd > VAL nd > > the two lines come from the fact that you included unit as a by variable > and here unit has two values, blank and 'nd'. > > Nat Wooding > > >


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