| 所在主题: | |
| 文件名: d9.zip | |
| 资料下载链接地址: https://bbs.pinggu.org/a-625230.html | |
本附件包括:
|
|
| 附件大小: | |
|
最近在学习SAS,正在读Analyzing stock using sas system.
其中第二章节用reg的方法来分析23只股票。目的就是用股票的dividend对growth rate,pe比值还有股票的std做regression。书不错,例子也很好懂。可是我在运用他的例子准备plot 线性回归的residual的时候,发现没有R(residual)这一项,reg这个函数根本没有R输出埃 我在附件里加了我的完整的code,可以直接运行的,各位高人如果能看看就太好了。 我卡在最后plot这步, proc plot data=dcf_reg1 vpct=125; plot r*gc='*' / vref=0; title2 'PE Regression Residuals'; title3 'versus Compound Growth Rate'; run; 第二行的r*gc 里的r被sas抱怨说找不到,按道理应该是reg自动输出吧,可是我看上一步的输出里,reg的确没有输出任何的residual。 data dcf2 ; input year stock1 stock2 stock3 stock4 stock5 stock6 stock7 stock8 stock9 stock10 stock11 stock12 stock13 stock14 stock15 stock16 stock17 stock18 stock19 stock20 stock21 stock22 stock23; array stock(23) stock1-stock23; array lstock(23) lstock1-lstock23; do i=1 to 23; lstock(i) = log(stock(i)); end; year2 = year*year; label stock1='3M Company' stock2='Allegheny Power' stock3='Cincinnati G&E' stock4='Detroit Edison' stock5='Dominion Resources' stock6='Duke Power' stock7='Eli Lilly' stock8='Green Mountain Power' stock9='Iowa-Ill Gas & Electric' stock10='Kansas Power & Light' stock11='Kentucky Utilities' stock12='Minnesota Power & Light' stock13='Northern States Power' stock14='Oklahoma Gas & Electric' stock15='Orange & Rockland Utilities' stock16='Pennsylvania Power & Light' stock17='Piedmont Natural Gas' stock18='Potomac Electric Power' stock19='TECO Energy' stock20='Texas Utilities' stock21='Union Electric' stock22='Wisconsin Energy' stock23='Wicor' lstock1='Natural Log 3M Company' lstock2='Natural Log Allegheny Power'; cards; 81 1.50 2.01 2.07 1.62 1.43 1.04.58 1.44 1.10 1.08 1.06 1.06 1.25 1.68 1.64 2.21.87.79.84 1.85 1.52.88 1.05 82 1.60 2.28 2.12 1.68 1.53 1.12.67 1.52 1.18 1.18 1.10 1.14 1.33 1.76 1.74 2.30.93.84.92 2.00 1.58.95 1.07 83 1.65 2.50 2.16 1.68 1.63 1.16.69 1.60 1.24 1.26 1.14 1.20 1.43 1.84 1.86 2.38.97.89 1.00 2.16 1.66 1.03 1.07 84 1.70 2.63 2.16 1.68 1.73 1.21.75 1.68 1.30 1.36 1.18 1.28 1.55 1.92 1.98 2.46 1.07.97 1.08 2.32 1.72 1.12 1.11 85 1.75 2.70 2.16 1.68 1.83 1.27.80 1.74 1.37 1.46 1.22 1.38 1.69 2.00 2.09 2.56 1.16 1.08 1.16 2.48 1.78 1.22 1.18 86 1.80 2.86 2.16 1.68 1.91 1.32.90 1.78 1.45 1.56 1.26 1.52 1.83 2.08 2.16 2.57 1.19 1.18 1.24 2.64 1.86 1.32 1.28 87 1.86 2.94 2.18 1.68 1.99 1.37 1.00 1.83 1.52 1.63 1.29 1.66 1.96 2.18 2.20 2.66 1.29 1.30 1.32 2.77 1.92 1.42 1.30 88 2.12 3.02 2.23 1.68 2.07 1.44 1.15 1.89 1.59 1.70 1.34 1.72 2.07 2.28 2.24 2.74 1.44 1.38 1.40 2.86 1.94 1.52 1.32 89 2.60 3.10 2.30 1.68 2.15 1.52 1.35 1.95 1.63 1.75 1.40 1.78 2.17 2.38 2.28 2.84 1.57 1.46 1.50 2.91 2.02 1.63 1.37 90 2.82 3.16 2.40 1.76 2.23 1.60 1.64 2.00 1.67 1.79 1.46 1.86 2.27 2.48 2.32 2.95 1.66 1.52 1.60 2.96 2.10 1.74 1.42 ; run; data dcf9; input firm $32. pepr ; label pe='Price Earning Ratio 1990' pr='Dividend Payout Ratio 1990'; cards; 3M Company 14.0 48 Allegheny Power 10.5 88 Cincinnati G&E 7.3 58 Detroit Edison 8.2 54 Dominion Resources 10.3 76 Duke Power 12.1 67 Eli Lilly 19.1 42 Green Mountain Power 10.8 87 Iowa-Ill Gas & Electric 10.6 84 Kansas Power & Light 10.0 80 Kentucky Utilities 9.9 74 Minnesota Power & Light 10.5 78 Northern States Power 12.3 81 Oklahoma Gas & Electric 10.7 73 Orange & Rockland Utilities9.8 78 Pennsylvania Power & Light10.6 75 Piedmont Natural Gas 11.3 68 Potomac Electric Power 13.0 94 TECO Energy 12.3 65 Texas Utilities 8.1 67 Union Electric 10.0 77 Wisconsin Energy 10.7 63 Wicor 20.9. ; run; /*Calculating the Standard Deviations of Dividend Growth Rates*/ proc means data=dcf2 noprint; var stock1-stock23; output out=dcf_std1 std=std1-std23; run; proc transpose data=dcf_std1 out=dcf_std2(rename=(col1=std)); var std1-std23; run; data dcf_cal2; merge dcf9 dcf_std2 dcf_call; run; proc print data=dcf_cal2; var pe gc pr std; title2'Cross-Sectional Multiple Regression Data'; title3'23 Observations'; run; proc reg data=dcf_cal2; model pe=gc pr std; output out=dcf_reg1; run; 谢谢大家 |
|
熟悉论坛请点击新手指南
|
|
| 下载说明 | |
|
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。 2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。 3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。 (如有侵权,欢迎举报) |
|
京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明