Date: Tue, 21 Dec 2004 17:37:45 -0800
Reply-To: Nageswar Rao Punnani <npunnani@gmail.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nageswar Rao Punnani <npunnani@GMAIL.COM>
Subject: Re: proc transpose - duplicate id values
In-Reply-To: <20041222012355.95468.qmail@web81001.mail.yahoo.com>
Content-Type: text/plain; charset=US-ASCII
I want to merge those records back in the data set to retain its originality.
On Tue, 21 Dec 2004 17:23:55 -0800 (PST), Dennis Diskin <diskin@snet.net> wrote:
> Rao,
>
> What do you want for a result? Proc transpose does not know what to do with
> the duplicate records. If you want to keep them, a common approach is to add
> a sequence counter for duplicate records within your by group and add thet
> to the by statement. But, you have to figure out what you are going to do
> with those records later.
>
> Regards,
> Dennis Diskin
>
>
> Nageswar Rao Punnani <npunnani@GMAIL.COM> wrote:
> Hi all ,
>
> I have sorted my data set with the by variables and then
> tried to transpose
> within the by group with the id variable. But the problem is in my
> data set , within the same by group i have duplicate id variable
> values and proc transpose is ignoring those observations . Is there a
> way to get around this .. any help is greatly appreciated.
>
> this is the code i wrote :
>
> proc transpose data = desktop.hosp_nonmissing1 out =
> work.hosp_nonmissingt prefix = code let;
> by patient_id hosp_adm_date hosp_disch_date;
> var diag_code ;
> id diag_code_number;
> run;
>
> log report :
> The ID value "code1" occurs twice in the same BY group
>
> sample observations where proc transpose is giving the error :
> id date1 date2 diag_code_number
> 12345 11/23/2004 12/23/2004 1
> 12345 11/23/2004 12/23/2004 1
> 12345 11/23/2004 12/23/2004 2
> 12345 11/23/2004 12/23/2004 3
>
> thanks in advance,
>
> Rao.
>
|