Date: Mon, 8 Feb 2010 08:04:05 -0800
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: How to solve this senario in datastep
In-Reply-To: <201002081240.o18BlqaW006976@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
Shaik,
You could do something like:
data want (drop=_:);
set have (rename=(t1=_t1 t2=_t2 t3=_t3));
length t1 t2 t3 $13;
retain t1 t2 t3;
select (level);
when ('se') do;
t1=put(_t1,5.2);
t2=put(_t2,5.2);
t3=put(_t3,5.2);
output;
end;
when ('low') do;
t1=catt("(",put(_t1,5.2));
t2=catt("(",put(_t2,5.2));
t3=catt("(",put(_t3,5.2));
end;
when ('hig') do;
level="lh";
t1=catt(t1,',',put(_t1,5.2),")");
t2=catt(t2,',',put(_t2,5.2),")");
t3=catt(t3,',',put(_t3,5.2),")");
output;
end;
end;
run;
HTH,
Art
----------
On Feb 8, 7:40 am, hyma...@GMAIL.COM (Shaik Hymad) wrote:
> Hi To all,
>
> I have data like,
>
> time level t1 t2 t3
>
> 1 se -0.4459 -0.6147822 0.212347412
> 1 low -0.3419 -0.7647873 -0.131827092
> 1 hig -0.2438 -1.1168602 0.0403563449
>
> 2 low -0.3419 -0.7647873 -0.131827092
> 2 hig -0.2438 -1.1168602 0.0403563449
>
> I want out put like
>
> time level t1 t2 t3
>
> 1 se -0.44 -0.61 0.21
> 1 lh (-0.34,-0.24) (-0.76,-1.12) (-0.13,-0.04)
>
> can you please check and let me know, how to do in datastep
|