/*Tab11_prediction_last_step.sas */ libname public 'd:\a_data\proj\size_fun\exports\revision\wrap\public';run; run; filename f1_1 'd:\a_data\proj\size_fun\exports\revision\wrap\public\z_output_all_1.asc'; filename f2_1 'd:\a_data\proj\size_fun\exports\revision\wrap\public\z_output_sim_1.asc'; filename f3_1 'd:\a_data\proj\size_fun\exports\revision\wrap\public\z_output_simChina_1.asc'; filename f1_2 'd:\a_data\proj\size_fun\exports\revision\wrap\public\z_output_all_2.asc'; filename f2_2 'd:\a_data\proj\size_fun\exports\revision\wrap\public\z_output_sim_2.asc'; filename f3_2 'd:\a_data\proj\size_fun\exports\revision\wrap\public\z_output_simChina_2.asc'; filename f4_2 'd:\a_data\proj\size_fun\exports\revision\wrap\public\output_sim_China_newpop_2.asc'; filename f_data 'd:\a_data\proj\size_fun\exports\revision\wrap\public\output_dataLQ_2.asc'; * f1_1: naicsindex ea_index LQest_base1 LQest_China LQest_base1_aprox LQest_China1_aprox s x LQsal97; * f1_2: naicsindex ea_index LQest_base2 LQest_China1 LQest_base1_aprox LQest_China2_aprox s x LQsal97 LQestChina_newpop1 LQestChina2_newpop_aprox chinanewcat naics; * f5_2: LQ97dat LQ07dat; *First load in data from primary segment; data part1_1; infile f1_1; input naicsindex ea_index LQest_base1 LQest_China1 LQest_base1_approx LQest_China1_approx s popshare97 LQsal97 ; drop s popshare97 LQsal97 ; *will get from other file; data part2_1; infile f2_1; input LQ1_RTM; data part3_1; infile f3_1; input LQ1_RTM_China; data dat1; merge part1_1 part2_1 part3_1; *Next load in data from full model with speciality segments; data part_data; infile f_data; input LQest97 LQest07; DATA part1_2; INFILE f1_2; input naicsindex ea_index LQest_base2 LQest_China2 LQest_base2_approx LQest_China2_approx s popshare97 LQsal97 LQestChina2_newpop LQestChina2_newpop_approx chinanewcat0 naics0; data part2_2; infile f2_2; input LQ2_RTM; data part3_2; infile f3_2; input LQ2_RTM_China; data part4_2; infile f4_2; input LQ2_RTM_China_Newpop; data dat2; merge part_data part1_2 part2_2 part3_2 part4_2; data naics; set public.ea_cm97; by naics; if first.naics; keep naics naicsindex; proc sort data=dat2; by naicsindex; data dat2; merge dat2(in=in1) naics; by naicsindex; drop naics0; if in1; data t97; set public.ea_cm97; est97=est_LM; estUS97=estUS_LM; emp97=emphat_LM; keep naicsindex ea_index est97 emp97 estUS97; data t07; set public.ea_cbp07; est07=est_cbp; emp07=emphat_cbp; s07=snorm_cbp/snormUS_cbp; estUS07=estUS_cbp; empUS07=emphatUS_cbp; keep naicsindex ea_index est07 emp07 s07 estUS07; run; proc sort data=dat2; by naicsindex ea_index; proc sort data=dat1; by naicsindex ea_index; data dat; merge dat1 dat2 t97 t07; by naicsindex ea_index; if s>=.05 and LQsal97>=2; if est97>0 then LQsize97=(s/est97)/(1/estUS97); if est07>0 then LQsize07=(s07/est07)/(1/estUS07); if LQest97>0 then difLQest_data=100*(LQest07-LQest97)/LQest97 ; if LQsize07^=. and LQsize97^=. then difLQsize_data=100*(LQsize07-LQsize97)/LQsize97 ; if LQest_base1>0 then difLQ1_china_exact=100*(LQest_china1-LQest_base1)/LQest_base1 ; if LQest_base1_approx>0 then difLQ1_china=100*(LQest_China1_approx-LQest_base1_approx)/LQest_base1_approx ; if LQest_base1_approx>0 then difLQ1_RTM=100*(LQ1_RTM-LQest_base1_approx)/LQest_base1_approx ; if LQest_base1_approx>0 then difLQ1_china_RTM=100*(LQ1_RTM_China-LQest_base1_approx)/LQest_base1_approx ; if LQest_base2>0 then difLQ2_china_exact=100*(LQest_china2-LQest_base2)/LQest_base2 ; if LQest_base2_approx>0 then difLQ2_china=100*(LQest_China2_approx-LQest_base2_approx)/LQest_base2_approx ; if LQest_base2_approx>0 then difLQ2_RTM=100*(LQ2_RTM-LQest_base2_approx)/LQest_base2_approx ; if LQest_base2_approx>0 then difLQ2_china_RTM=100*(LQ2_RTM_China-LQest_base2_approx)/LQest_base2_approx ; if LQest_base2_approx>0 then difLQ2_china_RTM_newpop=100*(LQ2_RTM_China_Newpop-LQest_base2_approx)/LQest_base2_approx ; if chinanewcat0 = 1 then chinacat2=1; if chinanewcat0 = 2 then chinacat2=2; if chinanewcat0 in (3,4,5,6) then chinacat2=3; run; ods html file="d:\a_data\proj\size_fun\exports\revision\wrap\public\Tab11_prediction_last_step.html" style=minimal; proc tabulate data=dat missing; class chinanewcat0; var LQsize97 LQest97 LQest07 difLQest_data ; table all chinanewcat0, N*f=7.0 mean*f=8.1*(LQsize97 LQest97 LQest07) mean*f=8.0*difLQest_data ; title 'conditonal on s>=.02 and LQsal97>=2'; proc tabulate data=dat; class chinanewcat0; var difLQ1_china difLQ1_RTM difLQ1_china_RTM difLQ2_china difLQ2_RTM difLQ2_china_RTM difLQ2_china_RTM_newpop; table chinanewcat0, N*f=7.0 mean*(difLQ1_china difLQ1_RTM difLQ1_china_RTM difLQ2_china difLQ2_RTM difLQ2_china_RTM difLQ2_china_RTM_newpop)*f=8.0; title 'conditonal on s>=.02 and LQsal97>=2'; proc ttest data=dat; where chinacat2 in (1,3); class chinacat2; var difLQest_data ; title 'compare 1 with 3'; proc ttest data=dat; where chinacat2 in (2,3); class chinacat2; var difLQest_data ; title 'compare 2 with 3'; run; ods html close; run;