proc import datafile='C:\Documents and Settings\mobileclub\Desktop\source\xls\data.xls'
out=demo1 dbms=excel replace;
sheet='sheet1$';
run;
proc sql;
select fname,length(fname) as len,
index(fname,'a') as ind1,
index(fname,'rao')as ind2 ,
scan(fname,2) as sc,
upcase (fname) as up from demo1;
quit;
proc sql;
select fname ,
compress (fname,'a') as comp1,
compress (fname) as comp2 ,
substr(fname,3 ,10) as sub1,
substr(fname,7) as sub2
from demo1;
quit;
/*data scrubbing*/
proc import datafile='C:\Documents and Settings\mobileclub\Desktop\source\xls\data.xls'
out=mh dbms=excel replace;
sheet='sheet3$';
run;
proc sql;
select pid,drug,dose,scan(adevents,1) as ae,
scan(adevents,2) as adr from mh;
quit;
proc import datafile='C:\Documents and Settings\mobileclub\Desktop\source\xls\data.xls'
out=ae dbms=excel replace;
sheet='sheet2$';
run;
proc sql;
select pid,drug ||' ' || dose as treatment from ae;
quit;
No comments:
Post a Comment