Date: Tue, 13 Mar 2007 17:27:30 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: A Simple Proc Transpose Question
In-Reply-To: <200703131639.l2DAkUeP023119@mailgw.cc.uga.edu>
Content-Type: text/plain; format=flowed
I agree with Harry in so much as we should be looking for the answer in
archives and online docs before asking the question.
Now on to the question SAS does this pretty easy with proc transpose. I
also saw no added valeu in housing the value 'hour' in the Hour variables
value. The information that 'hour' conveys is already conveyed in the
variable name. Also houseing 'hour' as part of the value just makes the
darn thing more complicated to use. In future versions of SAS I believe we
should be able to specify numeric lengths of numerics like 1 or 2 or 10 and
are not just stuck with 3 or 8, thereby saving us harddrive space and
gaining efficiency. So I would suggest removing 'hour' from the variables
value and houseing the varibale as a numeric.
Data Test ;
Infile Cards ;
Input Patient (Hour4 Hour8) (:$3.) ;
Cards ;
1 Yes Yes
2 No Yes
3 Yes No
;
Run ;
Proc Transpose
Data = Test
Out = Need ( Rename = ( _Name_ = OldHour Col1 = Response ) ) ;
By Patient ;
Var Hour: ;
Run ;
Data Need ( Drop = OldHour ) ;
Length Hour 8. ;
Set Need ;
Hour = Input( TranWrd( OldHour , 'Hour' , '' ) , 8. ) ;
Run ;
Proc Print
Data = Need ;
Run ;
Toby Dunn
To sensible men, every day is a day of reckoning. ~John W. Gardner
The important thing is this: To be able at any moment to sacrifice that
which we are for what we could become. ~Charles DuBois
Don't get your knickers in a knot. Nothing is solved and it just makes you
walk funny. ~Kathryn Carpenter
From: Rathindronath <mehedisas@YAHOO.COM>
Reply-To: Rathindronath <mehedisas@YAHOO.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: A Simple Proc Transpose Question
Date: Tue, 13 Mar 2007 12:39:43 -0400
I have a following dataset:
patient 4 hour 8 hour
------- ------ ------
1 Yes Yes
2 No Yes
3 Yes No
Now I need a following dataset:
Patient hour Response
------- ---- ---------
1 4 hour Yes
1 8 hour Yes
2 4 hour No
2 8 hour Yes
3 4 hour Yes
3 8 hour No
Thanks a lot. And please do not get mad at me since I have asked too
simple question. I am learning everyday.
_________________________________________________________________
Mortgage rates as low as 4.625% - Refinance $150,000 loan for $579 a month.
Intro*Terms
https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h27f6&disc=y&vers=743&s=4056&p=5117