Date: Tue, 19 Mar 2002 09:09:13 -0500
Reply-To: "Ji, Xinyu" <Xinyu.Ji@FALLON-CLINIC.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Ji, Xinyu" <Xinyu.Ji@FALLON-CLINIC.COM>
Subject: Re: oscillator cruve
Content-Type: text/plain; charset="iso-8859-1"
data raw;
input aa1 aa2 $;
cards;
22.10 +
22.05 +
21.72 +
22.63 -
22.97 -
22.90 -
23.34 -
23.46 -
24.15 -
25.28 +
25.95 +
25.89 -
26.11 -
25.71 -
25.69 -
25.31 +
25.78 +
25.53 +
25.95 -
25.91 -
;
run;
data desired (keep = aa1 aa2 aa3 aa4);
retain re_aa2 ' ' outerloop 0 innerloop;
set raw;
if aa2 ne re_aa2 then
do;
re_aa2 = aa2;
outerloop ++ 1;
innerloop = 1;
end;
if innerloop <= 2 then
do;
aa3 = aa1;
aa4 = outerloop;
end;
else do;
aa3 = .;
aa4 = .;
end;
innerloop ++ 1;
run;
proc print data = desired;
run;
-----Original Message-----
From: Morris [mailto:soaring-cato@YAHOO.COM.TW]
Sent: Tuesday, March 19, 2002 3:30 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: oscillator cruve
Dear List Members:
I have some question,i want to creat the another one
from the "aa1" and "aa2" variable (aa1 and aa2 are
given)
aa2 variable compose of "+"and "-" ,the aa3 variable
that i want is always the first and second observation
of "+" and "-" by each row group , and then creat aa4
form aa3
For example,
aa1 aa2 aa3 aa4
22.10 + 22.10 1
22.05 + 22.05 1
21.72 + . .
22.63 - 22.63 2
22.97 - 22.97 2
22.90 - . .
23.34 - . .
23.46 - . .
24.15 - . .
25.28 + 25.28 3
25.95 + 25.95 3
25.89 - 25.89 4
26.11 - 26.11 4
25.71 - . .
25.69 - . .
25.31 + 25.31 5
25.78 + 25.78 5
25.53 + . .
25.95 - 25.95 6
25.91 - 25.91 6
i was wondering if anyone could tell me how to do
this by sas ~~!!
many thanks,
morris hu
-----------------------------------------------------------------
< ??? Yahoo!?? > www.yahoo.com.tw