SAS程序范例1.docx
- 文档编号:6257504
- 上传时间:2023-01-04
- 格式:DOCX
- 页数:20
- 大小:256.08KB
SAS程序范例1.docx
《SAS程序范例1.docx》由会员分享,可在线阅读,更多相关《SAS程序范例1.docx(20页珍藏版)》请在冰豆网上搜索。
SAS程序范例1
5.9历年农村家庭出售畜产品水产品因子分析
SAS数据集d1是历年农村家庭出售畜产品水产品(单位:
公斤)。
SAS数据集d1中,x1是猪肉,x2是牛肉,x3是羊肉,x4是家禽,x5是蛋类,x6是牛羊奶,x7是蚕茧,x8是水产品。
本例用Factor过程对SAS数据集进行因子分析。
Method是因子分析方法,本例用主分量法(Prin);Rotate是因子旋转方法,本例用方差最大旋转方法(Varimax)。
%letd1=fjc.njcps;
%letc1=x1x2x3x4x5x6x7x8;
%leti1=date;
%macrofactor(method,rotate,x);
%doi=1%to1;
title"factor&&d&imethod=&methodrotate=&rotatenfactors=&x";
procfactordata=&&d&imethod=&methodnfactors=&xscree
rotate=&rotateout=a&i;
var&&c&i;
procprintdata=a&i(keep=datefactor1factor2factor3factor4factor5);
run;
%letplotitop=gopts=cback=blue,color=white,cframe=yellow;
%plotit(data=a&i,labelvar=&&i&i,
plotvars=factor2factor1,colors=magenta);
%end;
%mend;
%factor(prin,varimax,5);
表5.9.1d1关于变量x1–x8的因子分析
TheFACTORProcedure
InitialFactorMethod:
PrincipalComponents
PriorCommunalityEstimates:
ONE
EigenvaluesoftheCorrelationMatrix:
Total=8Average=1
EigenvalueDifferenceProportionCumulative
16.622257515.869673080.82780.8278
20.752584430.324255260.09410.9219
30.428329170.329070870.05350.9754
40.099258290.042884280.01240.9878
50.056374020.033280870.00700.9949
60.023093150.009261420.00290.9977
70.013831730.009560010.00170.9995
80.004271710.00051.0000
5factorswillberetainedbytheNFACTORcriterion.
TheFACTORProcedure
InitialFactorMethod:
PrincipalComponents
FactorPattern
Factor1Factor2Factor3Factor4Factor5
x10.905280.008660.412220.05426-0.03823
x20.97855-0.13329-0.053740.09498-0.01536
x30.92755-0.271120.193650.107810.10219
x40.981310.00391-0.15594-0.061620.04219
x50.968560.016920.00737-0.222690.09560
x60.88951-0.05390-0.438790.10359-0.01067
x70.585550.807890.025010.054770.01280
x80.97450-0.073130.02191-0.09248-0.18176
VarianceExplainedbyEachFactor
Factor1Factor2Factor3Factor4Factor5
6.62225750.75258440.42832920.09925830.0563740
FinalCommunalityEstimates:
Total=7.958803
x1x2x3x4x5x6x7x8
0.993929020.987473270.993428580.992876970.997183650.997513850.999336060.99706201
表5.9.2d1用最大方差旋转法的因子分析
TheFACTORProcedure
RotationMethod:
Varimax
OrthogonalTransformationMatrix
12345
10.672770.647350.325580.139950.05228
2-0.27899-0.188270.941270.013500.02345
30.67779-0.732930.05375-0.001600.02273
40.100450.088530.06986-0.91644-0.37057
50.00735-0.021620.015580.37465-0.92676
RotatedFactorPattern
Factor1Factor2Factor3Factor4Factor5
x10.891190.287910.328250.062090.07223
x20.668520.706690.196640.042430.02586
x30.842500.516900.066330.06532-0.08811
x40.547530.742440.311150.209910.03159
x50.630230.596640.317600.375660.04513
x60.326380.916980.222360.025530.00677
x70.191090.213190.956450.047410.01797
x80.680230.624300.240330.152010.25245
VarianceExplainedbyEachFactor
Factor1Factor2Factor3Factor4Factor5
3.25368473.03272001.37049880.22111320.0807867
FinalCommunalityEstimates:
Total=7.958803
X1X2X3X4X5X6X7X8
0.993929020.987473270.993428580.992876970.997183650.997513850.999336060.99706201
TheFACTORProcedure
RotationMethod:
Varimax
ScoringCoefficientsEstimatedbyRegression
SquaredMultipleCorrelationsoftheVariableswithEachFactor
Factor1Factor2Factor3Factor4Factor5
1.00000001.00000001.00000001.00000001.0000000
StandardizedScoringCoefficients
Factor1Factor2Factor3Factor4Factor5
x10.79098227-0.55597470.13469736-0.7373550.45526125
x20.157899150.31157218-0.0627429-0.9606059-0.1013109
x30.62360717-0.115901-0.1650845-0.3022728-2.0732228
x4-0.20537340.290640570.001858120.87071991-0.4639014
x5-0.1090969-0.1574243-0.06061252.71209425-0.7316066
x6-0.48057280.94775021-0.0087927-1.0078485-0.2292305
x7-0.1433306-0.14372711.08444468-0.3938737-0.3837445
x80.043478860.06328619-0.156105-0.33486873.33992889
表5.9.3d1因子分析结果
ObsdateFactor1Factor2Factor3Factor4Factor5
11985-1.10911-0.25369-2.181501.34490-0.07697
21989-1.32763-0.10876-0.956050.386680.13439
31990-1.23713-0.18648-0.34555-0.41269-0.22633
41991-0.93756-0.279030.14972-0.008630.13111
51992-0.85212-0.504130.575100.133130.54129
61993-0.34236-0.816860.94898-0.492730.11206
71994-0.48363-0.871271.65538-0.17423-0.75094
81995-0.32079-0.866821.333700.06509-0.79746
919960.99320-0.22694-1.26173-2.16888-1.47536
1019971.08633-0.19954-1.11979-0.78386-0.99129
111998-0.33411-0.00303-0.02264-0.557991.36122
1219990.97092-0.24442-0.45168-1.048652.54327
1320001.45850-0.64049-0.400712.44493-0.44471
1420011.43904-0.234510.812610.45093-0.65838
1520021.302920.465210.455250.575721.40237
1620030.203242.175270.283750.51298-0.41630
172004-0.509712.795490.52515-0.26668-0.38796
图5.9.1d1的(Factor2,Factor1)图(标号年份)
5.10地区城镇居民平均每人全年家庭收入因子分析
SAS数据集d1是各地区城镇居民平均每人全年家庭收入来源(2004年)。
x1是可支配收入,x2是总收入,x3是工薪收入,x4是经营净收入,x5是财产性收入,x6是转移性收入。
本例用Factor过程对SAS数据集进行因子分析。
Method是因子分析方法,本例用主分量法(Prin);Rotate是因子旋转方法,本例用方差最大旋转方法(Varimax)。
“%plotit(data=b&i,labelvar=x1,
plotvars=factor1x1,colors=magenta);
%plotit(data=b&i,labelvar=&&i&i,
plotvars=factor1x1,colors=magenta);”
表示画出b&i的两个图,标号分别x1为与地区。
%letd1=fjc.dqrjsr;
%letc1=x1x2x3x4x5x6;
%leti1=d;
%macrofactor(method,rotate,x);
%doi=1%to1;
title"factor&&d&imethod=&methodrotate=&rotatenfactors=&x";
procfactordata=&&d&imethod=&methodnfactors=&xscree
rotate=&rotateout=a&i;
var&&c&i;
procsortdata=a&iout=b&i;
byfactor1;
procprintdata=b&i(keep=dfactor1factor2factor3);
run;
%letplotitop=gopts=cback=blue,color=white,cframe=yellow;
%plotit(data=b&i,labelvar=x1,
plotvars=factor1x1,colors=magenta);
%plotit(data=b&i,labelvar=&&i&i,
plotvars=factor1x1,colors=magenta);
%end;
%mend;
%factor(prin,varimax,3);
表5.10.1d1关于变量x1–x6的因子分析
TheFACTORProcedure
InitialFactorMethod:
PrincipalComponents
PriorCommunalityEstimates:
ONE
EigenvaluesoftheCorrelationMatrix:
Total=6Average=1
EigenvalueDifferenceProportionCumulative
13.967828882.893271010.66130.6613
21.074557860.541006080.17910.8404
30.533551780.110441100.08890.9293
40.423110680.422159870.07050.9998
50.000950810.000950810.00021.0000
60.000000000.00001.0000
3factorswillberetainedbytheNFACTORcriterion.
FactorPattern
Factor1Factor2Factor3
x10.98304-0.16578-0.00417
x20.97755-0.19264-0.03349
x30.87138-0.34573-0.30864
x40.451230.809660.06503
x50.686380.48148-0.27725
x60.78219-0.055320.59670
VarianceExplainedbyEachFactor
Factor1Factor2Factor3
3.96782891.07455790.5335518
FinalCommunalityEstimates:
Total=5.575939
x1x2x3x4x5x6
0.993862880.993839960.974096680.863394560.779808780.97093565
表5.10.2d1用最大方差旋转法的因子分析
TheFACTORProcedure
RotationMethod:
Varimax
OrthogonalTransformationMatrix
123
10.789410.402020.46391
2-0.417340.90568-0.07467
3-0.45017-0.134660.88273
RotatedFactorPattern
Factor1Factor2Factor3
x10.847080.245620.46474
x20.867160.223030.43832
x30.971110.078760.15762
x4-0.010980.905940.20628
x50.465710.749330.03773
x60.371940.183990.89373
VarianceExplainedbyEachFactor
Factor1Factor2Factor3
2.76791571.53234861.2756742
FinalCommunalityEstimates:
Total=5.575939
x1x2x3x4x5x6
0.993862880.993839960.974096680.863394560.779808780.97093565
TheFACTORProcedure
RotationMethod:
Varimax
ScoringCoefficientsEstimatedbyRegression
SquaredMultipleCorrelationsoftheVariableswithEachFactor
Factor1Factor2Factor3
1.00000001.00000001.0000000
StandardizedScoringCoefficients
Factor1Factor2Factor3
x10.26347368-0.0390740.11958235
x2-0.6691815-0.40436983.27897357
x31.291425440.13631122-2.7841675
x4-0.19802020.74119647-0.1663793
x50.216483160.55725461-0.5213599
x6000
表5.10.3d1因子分析结果(按Factor1排序)
ObsdFactor1Factor2Factor3
1Heilongjiang-1.171590.061340.47570
2Jilin-1.079440.693070.19549
3Guizhou-1.015860.049990.00199
4Ningxia-0.98302-0.188360.23796
5Qinghai-0.89348-0.748930.55922
6InnerMongolia-0.759030.74000-0.19218
7Henan-0.72128-0.060940.12705
8Anhui-0.653670.17482-0.31600
9Jiangxi-0.64680-0.21335-0.18477
10Liaoning-0.57474-0.667950.54119
11Hebei-0.57013-0.469040.29540
12Sichuan-0.535940.34736-0.21636
13Gansu-0.36463-0.69588-0.50456
14Jiangsu-0.344690.943881.21347
15Shaanxi-0.29071-0.64101-0.33783
16Xinjiang-0.23192-0.53125-0.72922
17Tianjin-0.15457-0.063262.12146
18Hunan-0.13430-0.12676-0.33590
19Hainan-0.127420.23593-0.79185
20Yunnan-0.080611.19116-0.35119
21Shanxi-0.07836-0.24479-0.76952
22Hubei-0.06154-0.49023-0.60043
23Guangxi0.09846-0.15394-0.41539
24Chongqing0.21982-0.912880.13585
25Fujian0.518921.625520.05943
26Shandong0.82041-0.62905-1.10312
27Zhejiang1.215503.237090.33195
28Tibet1.79656-1.94695-2.48714
29Beijing1.95068-1.674162.70696
30Guangdong2.308231.57961-1.41059
31Shanghai2.54515-0.421021.74293
图5.10.1d1的(Factor2,X1)图(标号X1)
5.11地区生产总值因子分析
SAS数据集是地区生产总值(2004年),共有变量19个,分为4组。
第一组变量x1-x11;x1是地区生产总值(单位:
亿元),x2是第一产业,x3是第二产业,x4是工业,x5是建筑业,x6是第三产业,x7是交通运输仓储邮电通信业,x8是批发和零售贸易餐饮业,x9是金融,保险业,x10是房地产业,x11是其他行业。
第二组变量x12-x14,代表地区生产总值构成(%);x12是第一产业,x13是第二产业,x14是第三产业。
第三组变量x15-x18,代表地区生产总值指数(上年=100);x15是地区生产总值,x16是第一产业,x17是第二产业,x18是第三产业。
第四组是变量x19,为人均地区生产总值(元/人)。
SAS数据集d1对变量x1-x11用Factor过程对SAS数据集进行因子分析;SAS数据集d2对变量x1x2x3x6用Factor过程对SAS数据集进行因子分析。
Method是因子分析方法,本例用主分量法(Prin);Rotate是因子旋转方法,本例用方差最大旋转方法(Varimax)。
“%plotit(data=b&i,labelvar=x1,
plotvars=factor1x1,colors=magenta);
%plotit(data=b&i,labelvar=&&i&i,
plotvars=factor1x1,colors=magenta);”
表示画出b&i的两个(Factor1,x1)图,标号分别x1为与地区。
“%plotit(data=b&i,la
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- SAS 程序 范例