SAS+STATA数据运行后——输出大全

SAS+STATA数据运⾏后——输出⼤全options pagesize=53 linesize=76 pageno=1 nodate
formchar="|----|+|---"
;
在⼤数据运⾏中,我们不想输出log
dm log 'clear;' continue;
option nonotes;
proc printto log="c:\";
run;
proc printto log=_null_;
run;
proc print data=sashelp.class;
run;
%put 'not thing show' _all_;
proc printto log=log;
run;
proc print data=sashelp.class;
run;
%put _all_;
*** Point the log to its default destination;
proc printto;run;
proc printto print=null log=null;
run;quit;
proc print data=sashelp.class;
run;
proc means data=sashelp.class;
run;
proc printto;run;quit; 恢复log
1.输出LOG⽂件:
proc printto print='D:\shandong\log_print'  log='D:\shandong\log_orignal.log' new;
2.1SAS输出结果怎么转成WORD
options nodate nonumber;
ods listing close;
ods rtf file='c:\name.doc';
proc reg data=a;
model y=x;
run;
ods rtf close;
黄文超事件ods listing;
2.2SAS输出结果怎么转成PDF
options nodate nonumber;
ods listing close;
ods printer pdf file ='odsprinter.pdf';
proc reg data=a;
model y = x;
run;
ods printer close;
ods listing;
2.3SAS输出结果怎么转成XLS
options nodate nonumber;
ods listing close;
ods html file ='D:\A1.xls';
proc means data=sashelp.class ;
var age weight height;
title '格式⼤全';
run;
ods html close;
ods listing;
2.4SAS输出结果怎么转成HTML⽂件
options nodate nonumber;
ods listing close;
ods html file ='d:new.html';
proc means data=sasuser.score;
var math;
title '数学成绩';
run;
ods html close;
ods listing;
将SAS分析的结果写⼊到EXCEL中,这种表格⼗分的美观哦。
ods  lxp  file="d:\test.xls" options(sheet_name="print") style=analysis; proc print data=sashelp.class;run;
ods  lxp  options(sheet_name="freq");
proc freq data=sashelp.class;
tables sex;
run;
档案管理系统lxp close;
或者:
%macro o2xl(xlname,sdata);
ods tagsets.ExcelXP options(sheet_name="&name.") style=XLStatistical;
焦痂proc print data=&data. noobs label;
run;
%mend;
* style 需要另外设置, label 表⽰在excel输出sas标签;
ods results noresults;
ods listing close;
ods tagsets.ExcelXP file="..\file_name.xls" options(sheet_name="xlname0") style=XLStyle;
proc print data=sdata0 noobs label;
run;
*table 1;
%o2xl(xlname1,sdata1);
*table 2;
%o2xl(xlname2,sdata2);
……
lxp close;
⼀个综合的例⼦:
Logit 回归结果呈⽰:
options pagesize=53 linesize=76 pageno=1 nodate
formchar="|----|+|---";
ods listing close;
options nodate nonumber;
ods rtf file='d:\name.doc';
title 'LOGISTIC回归模型⽰范 ';
proc logistic data=Data1 desc;
model car_acq_dummy=region_new region_country  acq_industry equity_percentage acq_debt acq_tobin_q acq_book_to_market acq_state acq_cash_to_assets_ratio mean_rival_car region_state  debt_state
/stb aggregate scale=none lackfit  rsq  covb;
output out=mmm p=phat lower=lcl upper=ucl /alpha=0.05;
;
run; quit;
ods rtf close;
ods listing;
set more off
clear
sjlog using eststo1, replace
sysuse auto
regress price weight mpg
eststo
regress price weight mpg foreign
eststo
estout, style(fixed)
sjlog close, replace
clear all
set more off
set memo 400m
version 11
capture log close
cd  F:\match
set logtype text
log , replace
insheet using data01.csv,comma names
clear all
log close
2.STATA回归输出格式总结,⾮常的全⾯和使⽤。
pan.baidu/s/1eQpJzpC
STATA回归输出格式的设定命令
/bocode/e/estout/
estimates table small large, b(%7.4f) se(%7.4f) stats(N r2_a)
-----------------------------------
sysuse auto,clear
tabstat price wei len mpg rep78, stats(mean sd min p50 max) c(s) f(%6.2f)
logout, save(mytable) word replace: tabstat price wei len mpg rep78, stats(mean sd min p50 max) c(s) f(%6.2f) logout,save(mytable) word replace: pwcorr_a price wei len mpg rep78
logout,save(mytable) word replace: pwcorrs price wei len mpg rep78,sp
//pwcorrs 可以输出Spearman 相关系数表。
mat a=I(10)
mat list a
logout , save(mytable) word replace:mat list a,nohalf
-----------------------------------
sysuse auto,clear
reg price wei
est store m1
reg price wei len
est store m2
reg price wei len mpg foreign
est store m3
esttab m1 m2 m3
esttab m1 m2 m3,ar2 compress nogap  star(* 0.1 ** 0.05 *** 0.01)
esttab m1 m2 m3,ar2 compress nogap star(* 0.1 ** 0.05 *** 0.01)  b(%6.3f) brackets p
esttab m1 m2 m3,beta
label var weight "汽车重量"
esttab m1 m2 m3,label
中国民航安全飞行记录
esttab m1 m2 m3,margin //默认省略Constant
esttab m1 m2 m3,margin constant
esttab m1 m2 m3 using myout.html,replace  //追加的话,replace换为
append
esttab m1 m2 m3 using myout.csv,replace
esttab m1 m2 m3 using myout.csv,replace compress nogap nonotes scalars(r2_a N F)  star(* 0.1 ** 0.05 *** 0.01 ) obslast title("输⼊标题") addnotes("*** 1%  ** 5%  * 10%" "" "")
增加⼩数位显⽰,P值的显⽰。
est tab, p(.10g)
——————————————
sysuse auto, clear
reg price rep head trunk
est store m1
esttab m1  using myout.csv,replace compress  p(%6.4g) nogap nonotes scalars(r2_a N F)  star(* 0.1 ** 0.05 *** 0.01 ) obslast title("输⼊标题") addnotes("*** 1%  ** 5%  * 10%" "" "")
-----------------------例⼦-----------------------------
sysuse auto,clear
reg price wei
est store m1
reg price wei len
est store m2
reg price wei len mpg foreign
est store m3
logout , save(mylogout) word replace fix(3): esttab m1 m2 m3,mtitle(模型1 模型2 模型3) b(%6.3f) se(%6.2f) se star(* 0.1 ** 0.05 *** 0.01 ) scalar(r2 r2_a N F) compress nogap
以上⽐较⽜逼!
--------------------------------------------------------
sysuse auto,clear
reg price wei
est store m1
reg price wei len
est store m2
reg price wei len mpg foreign
est store m3
强卫任江西省委书记xml_tab m1 m2 m3 , replace
//默认显⽰标签,保存名称为l
ahpxml_tab m1 m2 m3 , save(result) sheet(OLS) replace ///
tstat blew stats(r2 r2_a N)
xml_tab m1 m2 m3 , save(result) sheet(OLS) replace ///
tstat blew stats(r2 r2_a N)        ///
drop(_Ioccup) font("Times new Roman" 10)  ///
title(table 1 表名)                                          ///
tblank(1)  format(NCCR3)                            ///
note("注释")
//中⽂标签要先修改或 nolabel
//save()  可以有具体路径
//可以有多个sheet

本文发布于:2024-09-23 05:29:47,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/505585.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

上一篇:SAS代码汇总
标签:输出   标签   结果   回归   转成   格式   数学
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议