SAS结果仿STATA输出&内生性问题



  • ods rtf file="D:\_云同步\_论文\20171215税收对收入流动性\1_1家庭税收总额作为核心自变量.rtf";
    proc syslin data=family LIML;
    endogenous  incstr;
    instruments tax_level urban jobclass_hz labor;
    MN_1: model  MT= labor labor2  Incstr  asset  house  meaneduy  experience_hz  experience_hz2  tax_new;
    ODS OUTPUT ParameterEstimates =MN_1;
    RUN;
    
    proc syslin data=family LIML;
    endogenous  incstr;
    instruments tax_level urban jobclass_hz labor;
    MN_2: model MT= labor labor2  Incstr  asset  house  meaneduy  experience_hz  experience_hz2  tax_new  tax_new2;
    ODS OUTPUT ParameterEstimates =MN_2;
    RUN;
    
    proc syslin data=family LIML;
    endogenous  incstr;
    instruments tax_level urban jobclass_hz labor;
    MN_3: model MT=labor labor2  Incstr  asset  house  meaneduy  experience_hz  experience_hz2  tax_tod;
    ODS OUTPUT ParameterEstimates =MN_3;
    RUN;
    proc syslin data=family LIML;
    endogenous  incstr;
    instruments tax_level urban jobclass_hz labor;
    MN_4: model MT= labor labor2  Incstr  asset  house  meaneduy  experience_hz  experience_hz2  tax_tod  tax_tod2;
    ODS OUTPUT ParameterEstimates =MN_4;
    RUN;
    proc syslin data=family LIML;
    endogenous  incstr;
    instruments tax_level urban jobclass_hz labor;
    MN_5: model MT= labor labor2  Incstr  asset  house  meaneduy  experience_hz  experience_hz2  tax_old;
    ODS OUTPUT ParameterEstimates =MN_5;
    RUN;
    proc syslin data=family LIML;
    endogenous  incstr;
    instruments tax_level urban jobclass_hz labor;
    MN_6: model MT=labor labor2  Incstr  asset  house  meaneduy  experience_hz  experience_hz2  tax_old  tax_old2;
    ODS OUTPUT ParameterEstimates =MN_6;
    RUN;
    ods rtf close;
    
    /*Tax_new Tax_old 出现共线性 tax_old        = +1.0000 * tax_new +1.0000 * shock3                                                           */
    data MN_1;
    	rename Variable=Parameter;
    	length Variable  $15;
    	set MN_1;	
    	attrib param label='M1' length=$20;
    	if Probt<=0.01 then param=strip(put(estimate,6.3))||' ***  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.05 then param=strip(put(estimate,6.3))||' **  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.1 then param=strip(put(estimate,6.3))||' *  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else param=strip(put(estimate,6.3))||'  ('||strip(put(Estimate/StdErr,6.2))||')';
    run;
    data MN_2;
    	rename Variable=Parameter;
    	length Variable  $15;
    	set MN_2;	
    	attrib param label='M2' length=$20;
    	if Probt<=0.01 then param=strip(put(estimate,6.3))||' ***  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.05 then param=strip(put(estimate,6.3))||' **  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.1 then param=strip(put(estimate,6.3))||' *  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else param=strip(put(estimate,6.3))||'  ('||strip(put(Estimate/StdErr,6.2))||')';
    run;
    data MN_3;
    	rename Variable=Parameter;
    	length Variable  $15;
    	set MN_3;	
    	attrib param label='M3' length=$20;
    	if Probt<=0.01 then param=strip(put(estimate,6.3))||' ***  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.05 then param=strip(put(estimate,6.3))||' **  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.1 then param=strip(put(estimate,6.3))||' *  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else param=strip(put(estimate,6.3))||'  ('||strip(put(Estimate/StdErr,6.2))||')';
    run;
    data MN_4;
    	rename Variable=Parameter;
    	length Variable  $15;
    	set MN_4;	
    	attrib param label='M4' length=$20;
    	if Probt<=0.01 then param=strip(put(estimate,6.3))||' ***  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.05 then param=strip(put(estimate,6.3))||' **  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.1 then param=strip(put(estimate,6.3))||' *  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else param=strip(put(estimate,6.3))||'  ('||strip(put(Estimate/StdErr,6.2))||')';
    run;
    data MN_5;
    	rename Variable=Parameter;
    	length Variable  $15;
    	set MN_5;	
    	attrib param label='M5' length=$20;
    	if Probt<=0.01 then param=strip(put(estimate,6.3))||' ***  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.05 then param=strip(put(estimate,6.3))||' **  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.1 then param=strip(put(estimate,6.3))||' *  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else param=strip(put(estimate,6.3))||'  ('||strip(put(Estimate/StdErr,6.2))||')';
    run;
    data MN_6;
    	rename Variable=Parameter;
    	length Variable  $15;
    	set MN_6;	
    	attrib param label='M6' length=$20;
    	if Probt<=0.01 then param=strip(put(estimate,6.3))||' ***  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.05 then param=strip(put(estimate,6.3))||' **  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else if Probt<=0.1 then param=strip(put(estimate,6.3))||' *  ('||strip(put(Estimate/StdErr,6.2))||')';
    	else param=strip(put(estimate,6.3))||'  ('||strip(put(Estimate/StdErr,6.2))||')';
    run;
    
    PROC SQL;
    CREATE TABLE CUI.T1_ADJ510 AS
    SELECT coalesce(A.Parameter,B.Parameter,C.Parameter,D.Parameter,E.Parameter,F.Parameter) as Parameter,
    A.param AS MN_1,B.param AS MN_2,C.param AS MN_3,D.param AS MN_4,E.param AS MN_5,F.param AS MN_6
    FROM MN_1 AS A 
    FULL JOIN MN_2 AS B
    ON A.Parameter=B.Parameter
    FULL JOIN MN_3 AS C
    ON A.Parameter=C.Parameter OR B.Parameter=C.Parameter
    FULL JOIN MN_4 AS D
    ON A.Parameter=D.Parameter OR B.Parameter=D.Parameter OR C.Parameter=D.Parameter
    FULL JOIN MN_5 AS E
    ON A.Parameter=E.Parameter OR B.Parameter=E.Parameter OR C.Parameter=E.Parameter OR D.Parameter=E.Parameter
    FULL JOIN MN_6 AS F
    ON A.Parameter=F.Parameter OR B.Parameter=F.Parameter OR C.Parameter=F.Parameter OR D.Parameter=F.Parameter OR E.Parameter=F.Parameter
    ;
    QUIT;
    
    PROC EXPORT DATA= CUI.T1_ADJ510
                OUTFILE= "D:\_云同步\_论文\20171215税收对收入流动性\T1_家庭税收总额作为核心自变量.csv" 
                DBMS=CSV REPLACE;
         PUTNAMES=YES;
    RUN;
    
    #也可以封装为宏块结构:
    /*6 个*/
    %MACRO Merge_6(OUT=T19 , A=,B=,C=,D=,E=,F=);
    PROC SQL;
    CREATE TABLE &OUT AS
    SELECT coalesce(A.Parameter,B.Parameter,C.Parameter,D.Parameter,E.Parameter,F.Parameter) as Parameter,
    A.param AS &A,B.param AS &B,C.param AS &C,D.param AS &D,
    E.param AS &E,F.param AS &F
    FROM &A AS A 
    FULL JOIN &B AS B
    ON A.Parameter=B.Parameter
    FULL JOIN &C AS C
    ON A.Parameter=C.Parameter OR B.Parameter=C.Parameter
    FULL JOIN &D AS D
    ON A.Parameter=D.Parameter OR B.Parameter=D.Parameter OR C.Parameter=D.Parameter
    FULL JOIN &E AS E
    ON A.Parameter=E.Parameter OR B.Parameter=E.Parameter OR C.Parameter=E.Parameter OR D.Parameter=E.Parameter
    FULL JOIN &F AS F
    ON A.Parameter=F.Parameter OR B.Parameter=F.Parameter OR C.Parameter=F.Parameter OR D.Parameter=F.Parameter OR E.Parameter=F.Parameter
    ;
    quit;
    
    PROC EXPORT DATA= &OUT
                OUTFILE= "D:\_云同步\_论文\20171215税收对收入流动性\&OUT..csv" 
                DBMS=CSV REPLACE;
         PUTNAMES=YES;
    RUN;
    %MEND;
    

登录后回复