Date: Tue, 13 May 2008 00:52:14 -0700
Reply-To: godfrey.guo@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: godfrey.guo@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: A VERY URGENT help needed - DATASET MODIFICATION - has been
made
Content-Type: text/plain; charset=ISO-8859-1
On May 13, 11:40 am, need_sas_h...@YAHOO.COM (Tom Smith) wrote:
> I had posted this problem earlier. But guesss I could not make it clear in
> my last post. So I think I cofused those who tried to help me out. So I am
> trying to make it clear below and more simple:
>
> I have a following dataset having variables:SUB, HR as bellow:
>
> SUB HR
> 1003 post
> 1003 pre
> 1004 post
> 1004 post
> 1004 Pre
> 1005 post
> 1005 pre
> 1005 failed
> 1005 never tried
>
> Need to create another dataset from it which will be by the variable SUB
> as below(means it will have only one observation for each SUB variable's
> value and all the values for HR for that perticular value of SUB will be
> in the same record one after another. Plz do not use Proc Report. I need a
> dataset.
> SUB HR
> 1003 post /
> pre
> 1004 post /post /
> Pre
> 1005 post / pre /
> failed /
> never tried
By this update one you may get the exact result what you want. Hope
can help you.
data a;
input sub hr$;
cards;
1003 post
1003 pre
1004 post
1004 post
1004 Pre
1005 post
1005 pre
1005 failed
1005 never tried
;
data b(drop=hr rename=(hour=hr));
set a;
by sub;
retain hour;
if first.sub then hour=cats(hr);
else hour=cats(hour)||'/'||cats(hr);
if last.sub then output;
run;
proc print data=b noobs;run;
|