data emp;
input eid surname $ name $;
cards;
101 konda ram
102 chittu kumar
;
data emp1;
set emp;
name1=trim(surname)||' '||(name);
run;
proc print data=emp1;
run;
proc import datafile='C:\Documents and Settings\mobileclub\Desktop\source\xls\data.xls'
out=mh_ae dbms=excel replace;
sheet='sheet3$';
run;
data mh_ae1;
set mh_ae;
treatment=compress(drug||'('||dose||')');
ae=scan(adevents,1);
adr=scan(adevents,2);
run;
proc print data=mh_ae1;
run;
proc import datafile='C:\Documents and Settings\mobileclub\Desktop\source\xls\data.xls'
out=qw dbms=excel replace;
sheet='sheet1$';
run;
data qw1;
set qw;
surname=scan(fname,1);
i=index(fname,' ');
name=substr(fname,i+1);
if gender='f' then g1='female';
else g1='male';
run;
proc print data=qw1;
run;
data qw2;
set qw;
name=substr(fname,(index(fname,' ')+1))||'.'||upcase(substr(fname,1,1));/*error*/
run;
data qw3;
set qw;
name=UPCASE(scan(fname,1))||'.'||scan(fname,2);
run;
data qw4;
set qw;
name=substr(fname,INDEX(fname,"")+1)||'.'||UPCASE(SUBSTR(FNAME,1,1));
run;
proc print data=qw2;
run;
data nu;
input x;
cards;
123
3456
45678
23
34567890
246
;
data nu1;
set nu;
len=length(compress(x));
run;
proc print data=nu1;
run;
data dm;
input cno $ phno ;
cards;
coo1 9884521015
c002 9988999999
c003 9111122222
;
data dm1;
set dm;
ph= '('||(substr(compress(phno),1,4))||')'||' '||'('||(substr(compress(phno),5))||')';
run;
proc print data=dm1;
run;
data demo;
input pid svisit : $ 20.;
cards;
101 18jan2003t13:23:23
102 19jan2003t10:34:36
;
proc print data=demo;
run;
data demo1;
set demo;
svdate=substr(svisit,1,index(svisit,'t')-1);
svtime=substr(svisit,index(svisit,'t')+1);
run;
proc print data=demo1;
run;
No comments:
Post a Comment