Sie sind auf Seite 1von 2

data ht;

input height$;
l= length(height);
find=l-1 ;
y=substr(height,find,2);
s= scan(height,1,y);
if y='in' then
do;
r=s*2.54;
height= cat(r,'cm');
end;
cards;
115cm
42in
150cm
122in
12cm
56in
;
run;
proc print;
run;
*dollar to rupee conversion;
data conversion;
input price$ 19.;
length l x r 8 ;
l=length(price);
s=substr(price,l,2);
x=scan(price,1,s);
if s='R' then
do;
r= x * 54.89;
price=cat(r,'D');
end;
cards;
100D
2R
250D
244R
223D
30R
;
run;
proc print;
run;

data list;
input name$ 11.;
s1= scan(name,1,' ');
s2=scan(name,-1,' ');
f1=upcase(substr(s1,1,1));
f2=upcase(substr(s2,1,1));
substr(s1,1,1)=f1;
substr(s2,1,1)=f2;
name= catx('',s1,s2);
cards;
james bond
ron cody
jhon mathew
;
run;
proc print;
run;

data datedemo;
input date anydtdte10.;
format date date9.;
y=year(date);
if y > 1999 then output;
cards;
10/10/1999
12/25/2000
04/26/2001
01/01/2005
05/15/1998
;
run;
proc print;
run;

Das könnte Ihnen auch gefallen