统计分析软件复习题答案
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
习题程序:
1.
data SCORE;
input name$ sex$ Chinese maths physics chemist English; sum= Chinese+maths+physics+chemist+English ;
mean=sum/5;
cards;
王辉男80 85 82 78 90
李唱女85 93 88 70 89
张三男77 86 67 82 85
王二女81 78 93 83 87
;run;
data jinrong;
Set SCORE;
Where maths>85;
Run;
2.
input x r;
do i=1 to 3;
x+x*r;
end;
cards;
500 0.07
;run;
3.
(1)data income;input year x1-x3;
income=x1+x2+x3;drop x1 x2 x3;
cards;
1985 298.28 29.47 39.95
1990 510.86 70.68 75.81
1995 996.51 287.24 195.74
2000 1125.34 488.89 515.35
2001 1165.17 532.61 533.80
;run;
(2)data income(keep=year income);
input year x1-x3;income=x1+x2+x3;
cards;
1985 298.28 29.47 39.95
1990 510.86 70.68 75.81
1995 996.51 287.24 195.74
2000 1125.34 488.89 515.35
2001 1165.17 532.61 533.80
;run;
(3)data income(drop=i);
input x1-x3;
array consum{3} x1-x3;
do i=1 to 3;
sum+consum(i);
end;
cards;
1985 298.28 29.47 39.95
1990 510.86 70.68 75.81
1995 996.51 287.24 195.74
2000 1125.34 488.89 515.35
2001 1165.17 532.61 533.80
;run;
4.
data group1 group2;
input region$ income@@;
if income>=2366.40 then do;
output group1;
n+1;
end;
else do;output group2;
m+1;
end;
cards;
beijing 5025.5 tianjin 3947.72 hebei 2603.6 shanxi 1956.05 nemenggu 1973.37 liaoning 2557.93 jilin 2182.22 heilong 2280.28 shanghai 5870.87 jiangsu 3784.71 zhejiang 4582.34 anhui 2020.04 fujian 3380.72 jiangxi 2231.6 shandong 2804.51 henan 2097.86 hubei 2352.16 hunanÏ 2299.46 guangdong 3769.79 guangxi 1944.33 hainan 2226.47 chongqing 1971.18 sichuan 1986.99 guizhou 1411.73 yunnan 1533.74 xizang 1404.01 shananxi 1490.8 gansu 1508.61 qinghai 1557.32 ningxia 1823.05 xinjiang 1710.44
;
proc print data=group1(drop=m);
title 'group1';
proc print data=group2(drop=n);
title 'group2';run;
5.
data a;
input region$ wage@@;
if wage<10000 then delete;
cards;
beijing 19776 tianjin 15110 hebei 9139 shanxi 8618 neimenggu 8737
liaoning 10609 jilin 9043 heilongjiang 8924 shanghai 21961
jiangsu 12917
zhejiang 19514 anhui 8501 fujian 13313 jiangxi 8346 shandong 11067
henan 8573 hubei 9133 hunan 9991 guangdong 16779 guangxi 9209 hainan 8102 chongqing 10035 sichuan 10783 guizhou 9308 yunnan 10880 xizang 20112 shananxi 9440 gansu 10442 qinghai 14028 ningxia 11112 xinjiang 10145
;run;
6.
data nongye;
input xiangmu$ year85 year90 year95 year00 year01;
cards;
gulei 2 1 1 1 1
roulei 2 1 1 1 1
mianhua 1 1 1 1 1
dadou 3 3 3 4 4
;
data gongye;
input xiangmu$ year85 year90 year95 year99 year00;
cards;
gang 4 4 2 1 1
mei 2 1 1 1 1
yuanyou 6 5 5 5 5
;
data order;set nongye gongye;proc print;run;
7.
data gdp;input gdp1-gdp45 @@;
cards;
144 150 165 168 200 216 218 185 173 181 208 240 254 235 222 243 275 288 292 309 310 327 316 339 379 417 460 489 525 580 692 853 956 1104 1355 1512 1634 1879 2287 2939 3923 4854 5576 6053 6392
;proc means data=gdp mean std cv skewness kurtosis
;run;
8.
data gdp;input area$ gdp consumpt capital export@@;
cards;
beijing 2845.65 1467.71 1775.3 -397.36
tianjin 1840.1 901.85 934.48 3.77
hebei 5577.78 2509.3 2511.57 556.91
shanxi 1787.76 1046.43 800.27 -58.94
neimenggu 1545.326789 936.1894062 614.1373826 -5 liaoning 5033.08 2828.09 1625.5 579.49
jilin 2087.87 1331.32 790.99 -34.44
heilongjiang 3515.69982 2110.54 1130.53982 274.62