SAS经典代码

data ;
name='leon';sex='m';age=30;
weight=83.5;height=175;
run;
proc print;
run;
proc datasets nolist;
delete %scan(&syslast,2);
quit;
data data1 data2;
name='leon';sex='m';age=30;
weight=83.5;height=175;
run;
proc print;
run;
data classa classb;
set sashelp.class;
if age>13 then output classa;
else output classb;
run;
proc print data=classa;
run;
data class1(keep=name age) class2(keep=name weight height);
set sashelp.class;
run;
proc print data=class1;
run;

libname mylib "E:\SAS学习\temp";
data mylib.class;
input name $ sex $ age height weight;
datalines;
asd m 14 14 14
sdf f 67 67 67
dff m 87 87 87
run;
proc print;
run;

data myclass;
infile datalines delimiter=',';
input name $ sex $ age height weight;
datalines;
dasd,m,23,23,23
df,m,45,45,45
fsdf,f,67,67,67
run;
proc print data=myclass;
run;
data myclass;
input name $ sex $ age height weight;
datalines4;
dasd;m 23 23 23
df;m 45 45 45
fsdf;f 67 67 67
;;;;
run;
proc print data=myclass;
run;
data myclass;
infile datalines4 dsd;
input name: $9. sex $ age height weight address: $32. description $24.;
datalines4;
sfs,m,14,14,13,"dfmslfdjdlfjdlk,fsf",fsffdfdes
;;;;
proc print data=myclass;
run;
data myclass;
 input name $1-15 sex $ age height weight;
 datalines;
 alfred liu m 12 121 22
 sda sdad m 34 34 34
 barbara deng f 45 45 45
 ;
 proc print data=myclass;
 run;
 data onerow;
 name='leon';sex='m';age=30;weight=83.5;height=175;
 run;
 data class2;
 set sashelp.class onerow;
 run;
 proc print data=class2;
 run;
data myclass;
set sashelp.class;
if _n_=1 then do;
output;
name='leon';sex='m';age=30;weight=30;weight=83.5;height=175;
end;
output;
run;
options obs=3;
proc print data=myclass;
run;
data myclass;
set  sashelp.class;
if _n_=3 then return;
else output;
run;
options obs=5;
proc print data=myclass;
run;
data myclass;
set sashelp.class;
if _N_=3  then name="BAY";
run;
options obs=3;
proc  print;
run;
data myclass ;
set sashelp.class;
where Name='BAY';
run;
proc print data=myclass;
run;
proc import datafile="d:\anaconda_coding\3.25-3.31网投.xls" dbms=xls out=class replace;
getnames=yes;
run;
proc print data=class encoding="utf-8";
run;
data _null_;
pi=constant("pi");
e=constant("e");
euler=constant('euler');
put pi e euler;
run;

 

你可能感兴趣的:(SAS相关技术概要)