parameters zftjb1,zftjb2,dwsl   &&统计表，数据表，单位数("zfans_b","zfdat_b",82)
private hh,bm?
dimension my(6),xz(6)
sele 1
use MYPATH+"dbf\"+zftjb2
sele 2
use MYPATH+"DBF\"+zftjb1 ALIAS zfans      &&数据表清空
replace all my1 with 0,my2 with 0,my3 with 0,my4 with 0,my5 with 0,my6 with 0,xz1 with 0,xz2 with 0,xz3 with 0,xz4 with 0,xz5 with 0,xz6 with 0,zhf with 0
go top
for hh=1 to dwsl  &&单位数
	STORE 0 to my,xz
	BM1="A"+alltrim(str(hh,2))
	BM2="B"+alltrim(str(hh,2))
	sele 1
	count to my(1) for &BM1=1    &&评价
	count to my(2) for &BM1=2
	count to my(3) for &BM1=3	   
	count to my(4) for &BM1=4	   
	count to my(5) for &BM1=5
	count to my(6) for &BM1=0
	count to xz(1) for SUBSTR(&BM2,1,1)="1"     &&问题
	count to xz(2) for SUBSTR(&BM2,2,1)="1"
	count to xz(3) for SUBSTR(&BM2,3,1)="1" 	   
	count to xz(4) for SUBSTR(&BM2,4,1)="1" 	   
	count to xz(5) for SUBSTR(&BM2,5,1)="1" 
	count to xz(6) for SUBSTR(&BM2,6,1)="1" 	   	   
	SELE 2
    replace my1 with my(1),my2 with my(2),my3 with my(3),my4 with my(4),my5 with my(5),my6 with my(6)
    replace xz1 with xz(1),xz2 with xz(2),xz3 with xz(3),xz4 with xz(4),xz5 with xz(5),xz6 with xz(6)
    skip
next 
sele 1
use
sele 2
repl all zhf with IIF(my1+my2+my3+my4+my5=0,0,(my1*0.95+my2*0.8+my3*0.65+my4*0.5+my5*0.35)/(my1+my2+my3+my4+my5))
index on 1000-zhf to pxsy    
return
