libname tt "D:\zhongxin\db2\test";
proc gchart data=tt.Result;
vbar3d name / discrete
sumvar=x1
group=name
legend=legend1
space=0
width=4
gspace=5
maxis=axis1
raxis=axis2
gaxis=axis3
cframe=grayaa
coutline=black
name='比较';
run;
quit;
data a;
name = "aaa";
age = 12;
output;
name = "bbb";
age = 100;
output;
run;
data _null_;
set a;
file "c:\a.csv" dlm = ",";
if _N_= 1 then do;
put "姓名,年龄";
put name age;
end;
else do;
put name age;
end;
run;
libname tt "D:\zhongxin\db2\test";
data customer;
set tt.customer(obs=1000);
run;
proc means data = customer /*std cv clm*/;
var Current_Line;
freq Current_Line;
run;
proc univariate data = customer;
var Current_Line;
run;
proc univariate data = customer normal plot;
var Current_Line;
run;
proc univariate data=customer noprint;
histogram Current_Line / cfill= red; /*图形,填充颜色*/
inset n = 'Current_Line' / position=ne;/*测度的标记*/
run;
proc univariate data = customer noprint;
histogram Current_Line / cframe = ligr
cfill = blue;
run;
proc univariate data=customer noprint;
histogram Current_Line / cframe = ligr
cfill = red
cframeside = ligr;
run;
proc univariate data=customer noprint;
class Customer_id;
histogram Current_Line / nrows = 3
cframe = ligr
cfill = red
cframeside = ligr;
run;
proc univariate data=customer noprint;
histogram Current_Line / normal cfill= green ctext = blue;
run;
/*example*/
data BPressure;
length PatientID $2;
input PatientID $ Systolic Diastolic @@;
datalines;
CK 120 50 SS 96 60 FR 100 70
CP 120 75 BL 140 90 ES 120 70
CP 165 110 JI 110 40 MC 119 66
FC 125 76 RW 133 60 KD 108 54
DS 110 50 JW 130 80 BH 120 65
JW 134 80 SB 118 76 NS 122 78
GS 122 70 AB 122 78 EC 112 62
HH 122 82
;
run;
proc univariate data=BPressure;
var Systolic Diastolic; /*分别统计2个变量的情况*/
run;
data Exam;
label Score = 'Exam Score';
input Score @@;
datalines;
81 97 78 99 77 81 84 86 86 97
85 86 94 76 75 42 91 90 88 86
97 97 89 69 72 82 83 81 80 81
;
run;
/*The following statements use the MODES option to request a table of all possible modes: */
proc univariate data=Exam modes;
var Score;
run;
proc univariate data=Exam;
var Score;
run;
proc univariate data=BPressure nextrval=5;
var Systolic Diastolic;
run;
proc univariate data=BPressure;
var Systolic Diastolic;
id PatientID;
run;
data Score;
input Student $ PreTest PostTest @@;
label ScoreChange = 'Change in Test Scores';
ScoreChange = PostTest - PreTest;
datalines;
Capalleti 94 91 Dubose 51 65
Engles 95 97 Grant 63 75
Krupski 80 75 Lundsford 92 55
Mcbane 75 78 Mullen 89 82
Nguyen 79 76 Patel 71 77
Si 75 70 Tanaka 87 73
;
run;
proc univariate data=Score freq;
var ScoreChange;
run;
data AirPoll (keep = Site Ozone);
label Site = 'Site Number'
Ozone = 'Ozone level (in ppb)';
do i = 1 to 3;
input Site @@;
do j = 1 to 15;
input Ozone @@;
output;
end;
end;
datalines;
102 4 6 3 4 7 8 2 3 4 1 3 8 9 5 6
134 5 3 6 2 1 2 4 3 2 4 6 4 6 3 1
137 8 9 7 8 6 7 6 7 9 8 9 8 7 8 5
;
run;
proc univariate data=AirPoll plot;
by Site;
var Ozone;
run;
data Belts;
label Strength = 'Breaking Strength (lb/in)'
Width = 'Width in Inches';
input Strength Width @@;
datalines;
1243.51 3.036 1221.95 2.995 1131.67 2.983 1129.70 3.019
1198.08 3.106 1273.31 2.947 1250.24 3.018 1225.47 2.980
1126.78 2.965 1174.62 3.033 1250.79 2.941 1216.75 3.037
1285.30 2.893 1214.14 3.035 1270.24 2.957 1249.55 2.958
1166.02 3.067 1278.85 3.037 1280.74 2.984 1201.96 3.002
1101.73 2.961 1165.79 3.075 1186.19 3.058 1124.46 2.929
1213.62 2.984 1213.93 3.029 1289.59 2.956 1208.27 3.029
1247.48 3.027 1284.34 3.073 1209.09 3.004 1146.78 3.061
1224.03 2.915 1200.43 2.974 1183.42 3.033 1195.66 2.995
1258.31 2.958 1136.05 3.022 1177.44 3.090 1246.13 3.022
1183.67 3.045 1206.50 3.024 1195.69 3.005 1223.49 2.971
1147.47 2.944 1171.76 3.005 1207.28 3.065 1131.33 2.984
1215.92 3.003 1202.17 3.058
;
run;
proc univariate data=Belts noprint;
var Strength Width;
output out=Means mean=StrengthMean WidthMean; /*输入的2个字段的平均值*/
output out=StrengthStats mean=StrengthMean WidthMean std=StrengthSD WidthSD
min=StrengthMin WidthMin max=StrengthMax WidthMax; /*输出4个字段,描述streng的属性*/
run;
data Robots;
input Length @@;
label Length = 'Attachment Point Offset (in mm)';
datalines;
10.147 10.070 10.032 10.042 10.102
10.034 10.143 10.278 10.114 10.127
10.122 10.018 10.271 10.293 10.136
10.240 10.205 10.186 10.186 10.080
10.158 10.114 10.018 10.201 10.065
10.061 10.133 10.153 10.201 10.109
10.122 10.139 10.090 10.136 10.066
10.074 10.175 10.052 10.059 10.077
10.211 10.122 10.031 10.322 10.187
10.094 10.067 10.094 10.051 10.174
;
run;
proc univariate data=Robots;
histogram Length /
beta(theta=10 scale=0.5 color=blue fill)
cfill = ywh
cframe = ligr
href = 10
hreflabel = 'Lower Bound'
lhref = 2
vaxis = axis1
name = 'MyHist';
axis1 label=(a=90 r=0);
inset n = 'Sample Size'
beta / pos=ne cfill=ywh;
run;
data Plates;
label Gap = 'Plate Gap in cm';
input Gap @@;
datalines;
0.746 0.357 0.376 0.327 0.485 1.741 0.241 0.777 0.768 0.409
0.252 0.512 0.534 1.656 0.742 0.378 0.714 1.121 0.597 0.231
0.541 0.805 0.682 0.418 0.506 0.501 0.247 0.922 0.880 0.344
0.519 1.302 0.275 0.601 0.388 0.450 0.845 0.319 0.486 0.529
1.547 0.690 0.676 0.314 0.736 0.643 0.483 0.352 0.636 1.080
;
run;
proc univariate data=Plates;
var Gap;
histogram / midpoints=0.2 to 1.8 by 0.2
lognormal (l=1 color=red)
weibull (l=2 color=blue)
gamma (l=8 color=yellow)
cframe = ligr
vaxis = axis1
name = 'MyHist';
inset n mean(5.3) std='Std Dev'(5.3) skewness(5.3)
/ pos = ne header = 'Summary Statistics' cfill = ywh;
axis1 label=(a=90 r=0);
run;
proc ttest data = Customer;
var Current_Line ;
run;
阅读(1743) | 评论(0) | 转发(0) |