Friday, 7 October 2011

When & Split


data trails;
input sno $ gno $ dose $;
cards;
s1 g1 asp-05mg
s1 g1 asp-10mg
s1 g1 asp-15mg
s2 g2 asp-05mg
s2 g2 asp-10mg
s2 g2 asp-15mg
;

data trail2;
set trails;
if dose='asp-05mg' then date='13jan2005'd;
else if dose='asp-10mg' then date='13jan2005'd+6;
else date='13jan2005'd+20;
run;
proc print data=trail2;
format date ddmmyyc10.;
run;

data mh1 mh2 mh3;
set trail2;
if dose='asp-05mg' then output mh1;
else if dose='asp-10mg' then output mh2;
else if dose='asp-15mg' then output mh3;
run;
proc print data=mh1;
format date ddmmyyd10.;
run;

proc print data=mh3;
format date ddmmyyb10.;
run;
data dm;
input pid salary sale;
cards;
101 2300 523
102 3300 451
103 2900 600
104 2200 258
105 5000 358
106 4500 350
;

data dm1;
set dm;
select;
when(sale>500) newsalary=salary+2000;
when(sale>350 and sale<500) newsalary=salary+1500;
otherwise newsalary=salary+1000;
end;
proc print data=dm1;
run;
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````

No comments:

Post a Comment