 * Authors:
 * Xuan Zhang, Ph.D. , Zhongnan Univ. of Econ. & Law (zhangx@znufe.edu.cn)
 * Cheng Pan , M.EC. , Zhongnan Univ. of Econ. & Law (panchengmail@163.com)
 * Chuntao Li, Ph.D. , Zhongnan Univ. of Econ. & Law (chtl@znufe.edu.cn)
 * August 20, 2013
 * Used to download stock financial data for listed Chinese Firms
 * Please do not use this code for commercial purpose

prog drop _all
program define chinafin, rclass
version 12
syntax anything(name=firms), [ path(string)]

clear
set more off

/*do loops for each company*/
 foreach stockcode in `firms' {
  clear
  while length("`stockcode'")<6 {
	   local stockcode = "0"+"`stockcode'"
	     }
  if length("`stockcode'")>6 {
	   disp as error `"`stockcode' is an invalid stock code"'
	   exit 601
	     }

  if "`path'"~="" {
          capture mkdir `path'
                       }

  if "`path'"=="" {
          local path="`c(pwd)'"
          disp "`path'"
                       }
  if index("`path'"," "){
          local path=subinstr("`path'"," ","_",.)
		  capture mkdir `path'
		  }
  tempfile temp
  capture copy "http://stockdata.stock.hexun.com/2008/lr.aspx?stockid=`stockcode'&accountdate=2012.12.31" `temp', replace

  if _rc != 0 {
  disp as error `"`stockcode' is an invalid stock code"'
  exit 601
      }

/*check the date in which finacial data was published*/

foreach sheet in lr zcfz xjll {
local d2=char(101)
tempfile datefile
local date2=char(104)
local file3=char(110)
local date1  "date"
local date3=char(120)+char(117)
local stockcode2=char(104)+char(116)
local c3=char(116)+char(112)+char(58)+char(47)+char(47)
local code3="`stockcode2'"+"`c3'"
local date4="`date2'"+"`d2'"+"`date3'"+"`file3'"
local ch=char(99)+char(111)+char(109)
set obs 500
gen str50 `date1'=""

qui copy "`code3'stockdata.stock.`date4'.`ch'/2008/`sheet'.aspx?stockid=`stockcode'&accountdate=2012.12.31"`datefile', replace

mata: gdate("`datefile'","`date1'")

drop if index(`date1',"Äê")
drop if `date1'==""
replace `date1' = reverse(substr(reverse(`date1'),2,10))

save `"`path'\/`sheet'"',replace
drop date
}

use `path'\lr
append  using "`path'\zcfz"
append  using "`path'\xjll"
bysort date:keep if _N==3
bysort date:keep if _n==1
keep if index(`date1',"12.31")

/*do loops for each date in which finacial data was published*/
 #delimit ;
capture postclose account ;
postfile account  str12  stkcd	 str12 date
A001
A002
A003
A004
A005
A006
A007
A008
A009
A010
A011
A012
A013
A014
A015
A016
A017
A018
A019
A020
A021
A022
A023
A024
A025
A026
A027
A028
A029
A030
A031
A032
A033
A034
A035
A036
A037
A038
A039
A040
A041
A042
A043
A044
A045
A046
A047
A048
A049
A050
A051
A052
A053
A054
A055
A056
A057
A058
A059
A060
A061
A062
A063
A064
A065
A066
A067
A068
A069
A070
A071
A072
A073
A074
A075
A076
A077
A078
A079
A080
A081
A082
A083
A084
A085
A086
A087
A088
A089
A090
A091
A092
A093
A094
A095
A096
A097
A098
A099
A100
A101
A102
A103
A104
A105
A106
A107
A108
P001
P002
P003
P004
P005
P006
P007
P008
P009
P010
P011
P012
P013
P014
P015
P016
P017
P018
P019
P020
P021
P022
P023
P024
P025
P026
P027
P028
P029
P030
P031
P032
P033
P034
P035
P036
P037
P038
P039
P040
P041
P042
P043
P044
P045
P046
P047
P048
C001
C002
C003
C004
C005
C006
C007
C008
C009
C010
C011
C012
C013
C014
C015
C016
C017
C018
C019
C020
C021
C022
C023
C024
C025
C026
C027
C028
C029
C030
C031
C032
C033
C034
C035
C036
C037
C038
C039
C040
C041
C042
C043
C044
C045
C046
C047
C048
C049
C050
C051
C052
C053
C054
C055
C056
C057
C058
C059
C060
C061
C062
C063
C064
C065
C066
C067
C068
C069
C070
C071
C072
C073
C074
C075
C076
C077
C078
C079
C080
C081
C082
C083 using `"`path'/`stockcode'"' ,replace ;
 #delimit cr

local obs=_N
  forvalues j=1/`obs'{
  preserve
  local adate=date[`j']
	local strvar "w"
	local temp "x"
	tempfile profit
	tempfile cashflow
	tempfile balance


qui {
	set obs 500
	gen str50 `strvar' = ""
    }
qui {
copy "`code3'stockdata.stock.`date4'.`ch'/2008/lr.aspx?stockid=`stockcode'&accountdate=`adate'" `profit', replace
copy "`code3'stockdata.stock.`date4'.`ch'/2008/xjll.aspx?stockid=`stockcode'&accountdate=`adate'" `cashflow', replace
copy "`code3'stockdata.stock.`date4'.`ch'/2008/zcfz.aspx?stockid=`stockcode'&accountdate=`adate'" `balance', replace
    }


mata: _cnaccount("`profit'","`cashflow'","`balance'","`strvar'")

qui drop if `strvar'==""
qui gen `temp' = `strvar'[_n+1] if mod(_n,2)==1
qui drop if `temp'==""

qui destring `temp', ignor(,) force replace

local OBS=_N

local A001=.
local A002=.
local A003=.
local A004=.
local A005=.
local A006=.
local A007=.
local A008=.
local A009=.
local A010=.
local A011=.
local A012=.
local A013=.
local A014=.
local A015=.
local A016=.
local A017=.
local A018=.
local A019=.
local A020=.
local A021=.
local A022=.
local A023=.
local A024=.
local A025=.
local A026=.
local A027=.
local A028=.
local A029=.
local A030=.
local A031=.
local A032=.
local A033=.
local A034=.
local A035=.
local A036=.
local A037=.
local A038=.
local A039=.
local A040=.
local A041=.
local A042=.
local A043=.
local A044=.
local A045=.
local A046=.
local A047=.
local A048=.
local A049=.
local A050=.
local A051=.
local A052=.
local A053=.
local A054=.
local A055=.
local A056=.
local A057=.
local A058=.
local A059=.
local A060=.
local A061=.
local A062=.
local A063=.
local A064=.
local A065=.
local A066=.
local P001=.
local P002=.
local P003=.
local P004=.
local P005=.
local P006=.
local P007=.
local P008=.
local P009=.
local P010=.
local P011=.
local P012=.
local P013=.
local P014=.
local P015=.
local P016=.
local P017=.
local P018=.
local P019=.
local P020=.
local P021=.
local P022=.
local P023=.
local P024=.
local P025=.
local P026=.
local C001=.
local C002=.
local C003=.
local C004=.
local C005=.
local C006=.
local C007=.
local C008=.
local C009=.
local C010=.
local C011=.
local C012=.
local C013=.
local C014=.
local C015=.
local C016=.
local C017=.
local C018=.
local C019=.
local C020=.
local C021=.
local C022=.
local C023=.
local C024=.
local C025=.
local C026=.
local C027=.
local C028=.
local C029=.
local C030=.
local C031=.
local C032=.
local C033=.
local C034=.
local C035=.
local C036=.
local C037=.
local C038=.
local C039=.
local C040=.
local C041=.
local C042=.
local C043=.
local C044=.
local C045=.
local C046=.
local C047=.
local C048=.
local C049=.
local C050=.
local C051=.
local C052=.
local C053=.
local C054=.
local C055=.
local C056=.
local C057=.
local C058=.
local C059=.
local C060=.
local C061=.
local C062=.
local C063=.
local C064=.
local C065=.
local C066=.
local C067=.
local A067=.
local A068=.
local A069=.
local A070=.
local A071=.
local A072=.
local A073=.
local A074=.
local A075=.
local A076=.
local A077=.
local A078=.
local A079=.
local A080=.
local A081=.
local A082=.
local A083=.
local A084=.
local A085=.
local A086=.
local A087=.
local A088=.
local A089=.
local A090=.
local A091=.
local A092=.
local A093=.
local A094=.
local A095=.
local A096=.
local A097=.
local A098=.
local A099=.
local A100=.
local A101=.
local A102=.
local A103=.
local A104=.
local A105=.
local A106=.
local A107=.
local A108=.
local P027=.
local P028=.
local P029=.
local P030=.
local P031=.
local P032=.
local P033=.
local P034=.
local P035=.
local P036=.
local P037=.
local P038=.
local P039=.
local P040=.
local P041=.
local P042=.
local P043=.
local P044=.
local P045=.
local P046=.
local P047=.
local P048=.
local C068=.
local C069=.
local C070=.
local C071=.
local C072=.
local C073=.
local C074=.
local C075=.
local C076=.
local C077=.
local C078=.
local C079=.
local C080=.
local C081=.
local C082=.
local C083=.

forval i = 1(1) `OBS' {
if w[`i']=="»õ±Ò×Ê½ð"  {
local A001= x[`i']
}
if w[`i']=="½»Ò×ÐÔ½ðÈÚ×Ê²ú"  {
local A002= x[`i']
}
if w[`i']=="Ó¦ÊÕÆ±¾Ý"  {
local A003= x[`i']
}
if w[`i']=="Ó¦ÊÕÕË¿î"  {
local A004= x[`i']
}
if w[`i']=="Ô¤¸¶¿îÏî"  {
local A005= x[`i']
}
if w[`i']=="ÆäËûÓ¦ÊÕ¿î"  {
local A006= x[`i']
}
if w[`i']=="Ó¦ÊÕ¹ØÁª¹«Ë¾¿î"  {
local A007= x[`i']
}
if w[`i']=="Ó¦ÊÕÀûÏ¢"  {
local A008= x[`i']
}
if w[`i']=="Ó¦ÊÕ¹ÉÀû"  {
local A009= x[`i']
}
if w[`i']=="´æ»õ"  {
local A010= x[`i']
}
if w[`i']=="ÆäÖÐ£ºÏûºÄÐÔÉúÎï×Ê²ú"  {
local A011= x[`i']
}
if w[`i']=="Ò»ÄêÄÚµ½ÆÚµÄ·ÇÁ÷¶¯×Ê²ú"  {
local A012= x[`i']
}
if w[`i']=="ÆäËûÁ÷¶¯×Ê²ú"  {
local A013= x[`i']
}
if w[`i']=="Á÷¶¯×Ê²úºÏ¼Æ"  {
local A014= x[`i']
}
if w[`i']=="¿É¹©³öÊÛ½ðÈÚ×Ê²ú"  {
local A015= x[`i']
}
if w[`i']=="³ÖÓÐÖÁµ½ÆÚÍ¶×Ê"  {
local A016= x[`i']
}
if w[`i']=="³¤ÆÚÓ¦ÊÕ¿î"  {
local A017= x[`i']
}
if w[`i']=="³¤ÆÚ¹ÉÈ¨Í¶×Ê"  {
local A018= x[`i']
}
if w[`i']=="Í¶×ÊÐÔ·¿µØ²ú"  {
local A019= x[`i']
}
if w[`i']=="¹Ì¶¨×Ê²ú"  {
local A020= x[`i']
}
if w[`i']=="ÔÚ½¨¹¤³Ì"  {
local A021= x[`i']
}
if w[`i']=="¹¤³ÌÎï×Ê"  {
local A022= x[`i']
}
if w[`i']=="¹Ì¶¨×Ê²úÇåÀí"  {
local A023= x[`i']
}
if w[`i']=="Éú²úÐÔÉúÎï×Ê²ú"  {
local A024= x[`i']
}
if w[`i']=="ÓÍÆø×Ê²ú"  {
local A025= x[`i']
}
if w[`i']=="ÎÞÐÎ×Ê²ú"  {
local A026= x[`i']
}
if w[`i']=="¿ª·¢Ö§³ö"  {
local A027= x[`i']
}
if w[`i']=="ÉÌÓþ"  {
local A028= x[`i']
}
if w[`i']=="³¤ÆÚ´ýÌ¯·ÑÓÃ"  {
local A029= x[`i']
}
if w[`i']=="µÝÑÓËùµÃË°×Ê²ú"  {
local A030= x[`i']
}
if w[`i']=="ÆäËû·ÇÁ÷¶¯×Ê²ú"  {
local A031= x[`i']
}
if w[`i']=="·ÇÁ÷¶¯×Ê²úºÏ¼Æ"  {
local A032= x[`i']
}
if w[`i']=="×Ê²ú×Ü¼Æ"  {
local A033= x[`i']
}
if w[`i']=="¶ÌÆÚ½è¿î"  {
local A034= x[`i']
}
if w[`i']=="½»Ò×ÐÔ½ðÈÚ¸ºÕ®"  {
local A035= x[`i']
}
if w[`i']=="Ó¦¸¶Æ±¾Ý"  {
local A036= x[`i']
}
if w[`i']=="Ó¦¸¶ÕË¿î"  {
local A037= x[`i']
}
if w[`i']=="Ô¤ÊÕ¿îÏî"  {
local A038= x[`i']
}
if w[`i']=="Ó¦¸¶Ö°¹¤Ð½³ê"  {
local A039= x[`i']
}
if w[`i']=="Ó¦½»Ë°·Ñ"  {
local A040= x[`i']
}
if w[`i']=="Ó¦¸¶ÀûÏ¢"  {
local A041= x[`i']
}
if w[`i']=="Ó¦¸¶¹ÉÀû"  {
local A042= x[`i']
}
if w[`i']=="ÆäËûÓ¦¸¶¿î"  {
local A043= x[`i']
}
if w[`i']=="Ó¦¸¶¹ØÁª¹«Ë¾¿î"  {
local A044= x[`i']
}
if w[`i']=="Ò»ÄêÄÚµ½ÆÚµÄ·ÇÁ÷¶¯¸ºÕ®"  {
local A045= x[`i']
}
if w[`i']=="ÆäËûÁ÷¶¯¸ºÕ®"  {
local A046= x[`i']
}
if w[`i']=="Á÷¶¯¸ºÕ®ºÏ¼Æ"  {
local A047= x[`i']
}
if w[`i']=="³¤ÆÚ½è¿î"  {
local A048= x[`i']
}
if w[`i']=="Ó¦¸¶Õ®È¯"  {
local A049= x[`i']
}
if w[`i']=="³¤ÆÚÓ¦¸¶¿î"  {
local A050= x[`i']
}
if w[`i']=="×¨ÏîÓ¦¸¶¿î"  {
local A051= x[`i']
}
if w[`i']=="Ô¤¼Æ¸ºÕ®"  {
local A052= x[`i']
}
if w[`i']=="µÝÑÓËùµÃË°¸ºÕ®"  {
local A053= x[`i']
}
if w[`i']=="ÆäËû·ÇÁ÷¶¯¸ºÕ®"  {
local A054= x[`i']
}
if w[`i']=="·ÇÁ÷¶¯¸ºÕ®ºÏ¼Æ"  {
local A055= x[`i']
}
if w[`i']=="¸ºÕ®ºÏ¼Æ"  {
local A056= x[`i']
}
if w[`i']=="ÊµÊÕ×Ê±¾£¨»ò¹É±¾£©"  {
local A057= x[`i']
}
if w[`i']=="×Ê±¾¹«»ý"  {
local A058= x[`i']
}
if w[`i']=="Ó¯Óà¹«»ý"  {
local A059= x[`i']
}
if w[`i']=="¼õ£º¿â´æ¹É"  {
local A060= x[`i']
}
if w[`i']=="Î´·ÖÅäÀûÈó"  {
local A061= x[`i']
}
if w[`i']=="ÉÙÊý¹É¶«È¨Òæ"  {
local A062= x[`i']
}
if w[`i']=="Íâ±Ò±¨±íÕÛËã¼Û²î"  {
local A063= x[`i']
}
if w[`i']=="·ÇÕý³£¾­ÓªÏîÄ¿ÊÕÒæµ÷Õû"  {
local A064= x[`i']
}
if w[`i']=="¹éÊôÄ¸¹«Ë¾ËùÓÐÕßÈ¨Òæ£¨»ò¹É¶«È¨Òæ£©"  {
local A065= x[`i']
}
if w[`i']=="ËùÓÐÕßÈ¨Òæ£¨»ò¹É¶«È¨Òæ£©ºÏ¼Æ"  {
local A066= x[`i']
}
if w[`i']=="Ò»¡¢ÓªÒµÊÕÈë"  {
local P001= x[`i']
}
if w[`i']=="¼õ£ºÓªÒµ³É±¾"  {
local P002= x[`i']
}
if w[`i']=="ÓªÒµË°½ð¼°¸½¼Ó"  {
local P003= x[`i']
}
if w[`i']=="ÏúÊÛ·ÑÓÃ"  {
local P004= x[`i']
}
if w[`i']=="¹ÜÀí·ÑÓÃ"  {
local P005= x[`i']
}
if w[`i']=="¿±Ì½·ÑÓÃ"  {
local P006= x[`i']
}
if w[`i']=="²ÆÎñ·ÑÓÃ"  {
local P007= x[`i']
}
if w[`i']=="×Ê²ú¼õÖµËðÊ§"  {
local P008= x[`i']
}
if w[`i']=="¼Ó£º¹«ÔÊ¼ÛÖµ±ä¶¯¾»ÊÕÒæ"  {
local P009= x[`i']
}
if w[`i']=="Í¶×ÊÊÕÒæ"  {
local P010= x[`i']
}
if w[`i']=="ÆäÖÐ£º¶ÔÁªÓªÆóÒµºÍºÏÓªÆóÒµµÄÍ¶×ÊÊÕÒæ"  {
local P011= x[`i']
}
if w[`i']=="Ó°ÏìÓªÒµÀûÈóµÄÆäËû¿ÆÄ¿"  {
local P012= x[`i']
}
if w[`i']=="¶þ¡¢ÓªÒµÀûÈó" | w[`i']== "Èý¡¢ÓªÒµÀûÈó" {
local P013= x[`i']
}
if w[`i']=="¼Ó£º²¹ÌùÊÕÈë"  {
local P014= x[`i']
}
if w[`i']=="ÓªÒµÍâÊÕÈë"  {
local P015= x[`i']
}
if w[`i']=="¼õ£ºÓªÒµÍâÖ§³ö"  {
local P016= x[`i']
}
if w[`i']=="ÆäÖÐ£º·ÇÁ÷¶¯×Ê²ú´¦ÖÃ¾»ËðÊ§"  {
local P017= x[`i']
}
if w[`i']=="¼Ó£ºÓ°ÏìÀûÈó×Ü¶îµÄÆäËû¿ÆÄ¿"  {
local P018= x[`i']
}
if w[`i']=="Èý¡¢ÀûÈó×Ü¶î" |  w[`i']=="ËÄ¡¢ÀûÈó×Ü¶î"  {
local P019= x[`i']
}
if w[`i']=="¼õ£ºËùµÃË°"  {
local P020= x[`i']
}
if w[`i']=="¼Ó£ºÓ°Ïì¾»ÀûÈóµÄÆäËû¿ÆÄ¿"  {
local P021= x[`i']
}
if w[`i']=="ËÄ¡¢¾»ÀûÈó" |  w[`i']=="Îå¡¢¾»ÀûÈó"{
local P022= x[`i']
}
if w[`i']=="¹éÊôÓÚÄ¸¹«Ë¾ËùÓÐÕßµÄ¾»ÀûÈó" |  w[`i']=="£¨Ò»£©¹éÊôÓÚÄ¸¹«Ë¾ËùÓÐÕßµÄ¾»ÀûÈó" {
local P023= x[`i']
}
if w[`i']=="ÉÙÊý¹É¶«ËðÒæ" |  w[`i']=="£¨¶þ£©ÉÙÊý¹É¶«ËðÒæ" {
local P024= x[`i']
}
if w[`i']=="Îå¡¢Ã¿¹ÉÊÕÒæ" | w[`i']=="Áù¡¢Ã¿¹ÉÊÕÒæ"  {
local P025= x[`i']
}
if w[`i']=="£¨Ò»£©»ù±¾Ã¿¹ÉÊÕÒæ"  {
local P026= x[`i']
}
if w[`i']=="Ò»¡¢¾­Óª»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿"  {
local C001= x[`i']
}
if w[`i']=="ÏúÊÛÉÌÆ·¡¢Ìá¹©ÀÍÎñÊÕµ½µÄÏÖ½ð"  {
local C002= x[`i']
}
if w[`i']=="ÊÕµ½µÄË°·Ñ·µ»¹"  {
local C003= x[`i']
}
if w[`i']=="ÊÕµ½ÆäËûÓë¾­Óª»î¶¯ÓÐ¹ØµÄÏÖ½ð"  {
local C004= x[`i']
}
if w[`i']=="¾­Óª»î¶¯ÏÖ½ðÁ÷ÈëÐ¡¼Æ"  {
local C005= x[`i']
}
if w[`i']=="¹ºÂòÉÌÆ·¡¢½ÓÊÜÀÍÎñÖ§¸¶µÄÏÖ½ð"  {
local C006= x[`i']
}
if w[`i']=="Ö§¸¶¸øÖ°¹¤ÒÔ¼°ÎªÖ°¹¤Ö§¸¶µÄÏÖ½ð"  {
local C007= x[`i']
}
if w[`i']=="Ö§¸¶µÄ¸÷ÏîË°·Ñ"  {
local C008= x[`i']
}
if w[`i']=="Ö§¸¶ÆäËûÓë¾­Óª»î¶¯ÓÐ¹ØµÄÏÖ½ð"  {
local C009= x[`i']
}
if w[`i']=="¾­Óª»î¶¯ÏÖ½ðÁ÷³öÐ¡¼Æ"  {
local C010= x[`i']
}
if w[`i']=="¾­Óª»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿¾»¶î"  {
local C011= x[`i']
}
if w[`i']=="¶þ¡¢Í¶×Ê»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿"  {
local C012= x[`i']
}
if w[`i']=="ÊÕ»ØÍ¶×ÊÊÕµ½µÄÏÖ½ð"  {
local C013= x[`i']
}
if w[`i']=="È¡µÃÍ¶×ÊÊÕÒæÊÕµ½µÄÏÖ½ð"  {
local C014= x[`i']
}
if w[`i']=="´¦ÖÃ¹Ì¶¨×Ê²ú¡¢ÎÞÐÎ×Ê²úºÍÆäËû³¤ÆÚ×Ê²úÊÕ»ØµÄÏÖ½ð¾»¶î"  {
local C015= x[`i']
}
if w[`i']=="´¦ÖÃ×Ó¹«Ë¾¼°ÆäËûÓªÒµµ¥Î»ÊÕµ½µÄÏÖ½ð¾»¶î"  {
local C016= x[`i']
}
if w[`i']=="ÊÕµ½ÆäËûÓëÍ¶×Ê»î¶¯ÓÐ¹ØµÄÏÖ½ð"  {
local C017= x[`i']
}
if w[`i']=="Í¶×Ê»î¶¯ÏÖ½ðÁ÷ÈëÐ¡¼Æ"  {
local C018= x[`i']
}
if w[`i']=="¹º½¨¹Ì¶¨×Ê²ú¡¢ÎÞÐÎ×Ê²úºÍÆäËû³¤ÆÚ×Ê²úÖ§¸¶µÄÏÖ½ð"  {
local C019= x[`i']
}
if w[`i']=="Í¶×ÊÖ§¸¶µÄÏÖ½ð"  {
local C020= x[`i']
}
if w[`i']=="È¡µÃ×Ó¹«Ë¾¼°ÆäËûÓªÒµµ¥Î»Ö§¸¶µÄÏÖ½ð¾»¶î"  {
local C021= x[`i']
}
if w[`i']=="Ö§¸¶ÆäËûÓëÍ¶×Ê»î¶¯ÓÐ¹ØµÄÏÖ½ð"  {
local C022= x[`i']
}
if w[`i']=="Í¶×Ê»î¶¯ÏÖ½ðÁ÷³öÐ¡¼Æ"  {
local C023= x[`i']
}
if w[`i']=="Í¶×Ê»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿¾»¶î"  {
local C024= x[`i']
}
if w[`i']=="Èý¡¢³ï×Ê»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿"  {
local C025= x[`i']
}
if w[`i']=="ÎüÊÕÍ¶×ÊÊÕµ½µÄÏÖ½ð"  {
local C026= x[`i']
}
if w[`i']=="È¡µÃ½è¿îÊÕµ½µÄÏÖ½ð"  {
local C027= x[`i']
}
if w[`i']=="ÊÕµ½ÆäËûÓë³ï×Ê»î¶¯ÓÐ¹ØµÄÏÖ½ð"  {
local C028= x[`i']
}
if w[`i']=="³ï×Ê»î¶¯ÏÖ½ðÁ÷ÈëÐ¡¼Æ"  {
local C029= x[`i']
}
if w[`i']=="³¥»¹Õ®ÎñÖ§¸¶µÄÏÖ½ð"  {
local C030= x[`i']
}
if w[`i']=="·ÖÅä¹ÉÀû¡¢ÀûÈó»ò³¥¸¶ÀûÏ¢Ö§¸¶µÄÏÖ½ð"  {
local C031= x[`i']
}
if w[`i']=="Ö§¸¶ÆäËûÓë³ï×Ê»î¶¯ÓÐ¹ØµÄÏÖ½ð"  {
local C032= x[`i']
}
if w[`i']=="³ï×Ê»î¶¯ÏÖ½ðÁ÷³öÐ¡¼Æ"  {
local C033= x[`i']
}
if w[`i']=="³ï×Ê»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿¾»¶î"  {
local C034= x[`i']
}
if w[`i']=="ËÄ¡¢»ãÂÊ±ä¶¯¶ÔÏÖ½ðµÄÓ°Ïì"  {
local C035= x[`i']
}
if w[`i']=="ËÄ(2)¡¢ÆäËûÔ­Òò¶ÔÏÖ½ðµÄÓ°Ïì"  {
local C036= x[`i']
}
if w[`i']=="Îå¡¢ÏÖ½ð¼°ÏÖ½ðµÈ¼ÛÎï¾»Ôö¼Ó¶î"  {
local C037= x[`i']
}
if w[`i']=="ÆÚ³õÏÖ½ð¼°ÏÖ½ðµÈ¼ÛÎïÓà¶î"  {
local C038= x[`i']
}
if w[`i']=="ÆÚÄ©ÏÖ½ð¼°ÏÖ½ðµÈ¼ÛÎïÓà¶î"  {
local C039= x[`i']
}
if w[`i']=="¸½×¢£º1¡¢½«¾»ÀûÈóµ÷½ÚÎª¾­Óª»î¶¯ÏÖ½ðÁ÷Á¿"  {
local C040= x[`i']
}
if w[`i']=="¾»ÀûÈó"  {
local C041= x[`i']
}
if w[`i']=="¼Ó£º×Ê²ú¼õÖµ×¼±¸"  {
local C042= x[`i']
}
if w[`i']=="¹Ì¶¨×Ê²úÕÛ¾É¡¢ÓÍÆø×Ê²úÕÛºÄ¡¢Éú²úÐÔÉúÎï×Ê²úÕÛ¾É"  {
local C043= x[`i']
}
if w[`i']=="ÎÞÐÎ×Ê²úÌ¯Ïú"  {
local C044= x[`i']
}
if w[`i']=="³¤ÆÚ´ýÌ¯·ÑÓÃÌ¯Ïú"  {
local C045= x[`i']
}
if w[`i']=="´¦ÖÃ¹Ì¶¨×Ê²ú¡¢ÎÞÐÎ×Ê²úºÍÆäËû³¤ÆÚ×Ê²úµÄËðÊ§"  {
local C046= x[`i']
}
if w[`i']=="¹Ì¶¨×Ê²ú±¨·ÏËðÊ§"  {
local C047= x[`i']
}
if w[`i']=="¹«ÔÊ¼ÛÖµ±ä¶¯ËðÊ§"  {
local C048= x[`i']
}
if w[`i']=="²ÆÎñ·ÑÓÃ"  {
local C049= x[`i']
}
if w[`i']=="Í¶×ÊËðÊ§"  {
local C050= x[`i']
}
if w[`i']=="µÝÑÓËùµÃË°×Ê²ú¼õÉÙ"  {
local C051= x[`i']
}
if w[`i']=="µÝÑÓËùµÃË°¸ºÕ®Ôö¼Ó"  {
local C052= x[`i']
}
if w[`i']=="´æ»õµÄ¼õÉÙ"  {
local C053= x[`i']
}
if w[`i']=="¾­ÓªÐÔÓ¦ÊÕÏîÄ¿µÄ¼õÉÙ"  {
local C054= x[`i']
}
if w[`i']=="¾­ÓªÐÔÓ¦¸¶ÏîÄ¿µÄÔö¼Ó"  {
local C055= x[`i']
}
if w[`i']=="ÆäËû"  {
local C056= x[`i']
}
if w[`i']=="¾­Óª»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿¾»¶î2"  {
local C057= x[`i']
}
if w[`i']=="2¡¢²»Éæ¼°ÏÖ½ðÊÕÖ§µÄÖØ´óÍ¶×ÊºÍ³ï×Ê»î¶¯"  {
local C058= x[`i']
}
if w[`i']=="Õ®Îñ×ªÎª×Ê±¾"  {
local C059= x[`i']
}
if w[`i']=="Ò»ÄêÄÚµ½ÆÚµÄ¿É×ª»»¹«Ë¾Õ®È¯"  {
local C060= x[`i']
}
if w[`i']=="ÈÚ×Ê×âÈë¹Ì¶¨×Ê²ú"  {
local C061= x[`i']
}
if w[`i']=="3¡¢ÏÖ½ð¼°ÏÖ½ðµÈ¼ÛÎï¾»±ä¶¯Çé¿ö"  {
local C062= x[`i']
}
if w[`i']=="ÏÖ½ðµÄÆÚÄ©Óà¶î"  {
local C063= x[`i']
}
if w[`i']=="¼õ£ºÏÖ½ðµÄÆÚ³õÓà¶î"  {
local C064= x[`i']
}
if w[`i']=="¼Ó£ºÏÖ½ðµÈ¼ÛÎïµÄÆÚÄ©Óà¶î"  {
local C065= x[`i']
}
if w[`i']=="¼õ£ºÏÖ½ðµÈ¼ÛÎïµÄÆÚ³õÓà¶î"  {
local C066= x[`i']
}
if w[`i']=="¼Ó£ºÆäËûÔ­Òò¶ÔÏÖ½ðµÄÓ°Ïì2"  {
local C067= x[`i']
}
if w[`i']=="ÏÖ½ð¼°´æ·ÅÍ¬Òµ¿îÏî"  {
local A067= x[`i']
}
if w[`i']=="¿Í»§×Ê½ð´æ¿î"  {
local A068= x[`i']
}
if w[`i']=="´æ·ÅÖÐÑëÒøÐÐ¿îÏî"  {
local A069= x[`i']
}
if w[`i']=="½áËã±¸¸¶½ð"  {
local A070= x[`i']
}
if w[`i']=="¿Í»§±¸¸¶½ð"  {
local A071= x[`i']
}
if w[`i']=="¹ó½ðÊô"  {
local A072= x[`i']
}
if w[`i']=="²ð³ö×Ê½ð"  {
local A073= x[`i']
}
if w[`i']=="ÑÜÉú½ðÈÚ×Ê²ú"  {
local A074= x[`i']
}
if w[`i']=="ÂòÈë·µÊÛ½ðÈÚ×Ê²ú"  {
local A075= x[`i']
}
if w[`i']=="Ó¦ÊÕ±£·Ñ"  {
local A076= x[`i']
}
if w[`i']=="Ó¦ÊÕ´úÎ»×·³¥¿î"  {
local A077= x[`i']
}
if w[`i']=="Ó¦ÊÕ·Ö±£ÕÊ¿î"  {
local A078= x[`i']
}
if w[`i']=="Ó¦ÊÕ·Ö±£Î´µ½ÆÚÔðÈÎ×¼±¸½ð"  {
local A079= x[`i']
}
if w[`i']=="Ó¦ÊÕ·Ö±£Î´¾öÅâ¿î×¼±¸½ð"  {
local A080= x[`i']
}
if w[`i']=="Ó¦ÊÕ·Ö±£ÊÙÏÕÔðÈÎ×¼±¸½ð"  {
local A081= x[`i']
}
if w[`i']=="Ó¦ÊÕ·Ö±£³¤ÆÚ½¡¿µÏÕÔðÈÎ×¼±¸½ð"  {
local A082= x[`i']
}
if w[`i']=="±£»§ÖÊÑº´û¿î"  {
local A083= x[`i']
}
if w[`i']=="¶¨ÆÚ´æ¿î"  {
local A084= x[`i']
}
if w[`i']=="·¢·Å´û¿î¼°µæ¿î"  {
local A085= x[`i']
}
if w[`i']=="´æ³ö±£Ö¤½ð"  {
local A086= x[`i']
}
if w[`i']=="´úÀíÒµÎñ×Ê²ú"  {
local A087= x[`i']
}
if w[`i']=="½»Ò×Ï¯Î»·Ñ"  {
local A088= x[`i']
}
if w[`i']=="¶ÀÁ¢ÕÊ»§×Ê²ú"  {
local A089= x[`i']
}
if w[`i']=="ÏòÖÐÑëÒøÐÐ½è¿î"  {
local A090= x[`i']
}
if w[`i']=="Í¬Òµ¼°ÆäËû½ðÈÚ»ú¹¹´æ·Å¿îÏî"  {
local A091= x[`i']
}
if w[`i']=="ÖÊÑº½è¿î"  {
local A092= x[`i']
}
if w[`i']=="²ðÈë×Ê½ð"  {
local A093= x[`i']
}
if w[`i']=="ÑÜÉú½ðÈÚ¸ºÕ®"  {
local A094= x[`i']
}
if w[`i']=="Âô³ö»Ø¹º½ðÈÚ×Ê²ú¿î"  {
local A095= x[`i']
}
if w[`i']=="ÎüÊÕ´æ¿î"  {
local A096= x[`i']
}
if w[`i']=="´úÀíÂòÂôÖ¤È¯¿î"  {
local A097= x[`i']
}
if w[`i']=="´úÀí³ÐÏúÖ¤È¯¿î"  {
local A098= x[`i']
}
if w[`i']=="Ô¤ÊÕ±£·Ñ"  {
local A099= x[`i']
}
if w[`i']=="´úÀíÒµÎñ¸ºÕ®"  {
local A100= x[`i']
}
if w[`i']=="Ó¦¸¶±£µ¥ºìÀû"  {
local A101= x[`i']
}
if w[`i']=="±£»§´¢½ð¼°Í¶×Ê¿î"  {
local A102= x[`i']
}
if w[`i']=="Î´µ½ÆÚÔðÈÎ×¼±¸½ð"  {
local A103= x[`i']
}
if w[`i']=="Î´¾öÅâ¿î×¼±¸½ð"  {
local A104= x[`i']
}
if w[`i']=="ÊÙÏÕÔðÈÎ×¼±¸½ð"  {
local A105= x[`i']
}
if w[`i']=="³¤ÆÚ½¡¿µÏÕÔðÈÎ×¼±¸½ð"  {
local A106= x[`i']
}
if w[`i']=="¶ÀÁ¢ÕÊ»§¸ºÕ®"  {
local A107= x[`i']
}
if w[`i']=="Ò»°ã·çÏÕ×¼±¸"  {
local A108= x[`i']
}
if w[`i']=="ÀûÏ¢¾»ÊÕÈë"  {
local P027= x[`i']
}
if w[`i']=="ÀûÏ¢ÊÕÈë"  {
local P028= x[`i']
}
if w[`i']=="ÀûÏ¢Ö§³ö"  {
local P029= x[`i']
}
if w[`i']=="ÊÖÐø·Ñ¼°Ó¶½ð¾»ÊÕÈë"  {
local P030= x[`i']
}
if w[`i']=="ÊÖÐø·Ñ¼°Ó¶½ðÊÕÈë"  {
local P031= x[`i']
}
if w[`i']=="´úÀíÂòÂôÖ¤È¯ÒµÎñ¾»ÊÕÈë"  {
local P032= x[`i']
}
if w[`i']=="Ö¤È¯³ÐÏúÒµÎñ¾»ÊÕÈë"  {
local P033= x[`i']
}
if w[`i']=="Î¯ÍÐ¿Í»§¹ÜÀí×Ê²úÒµÎñ¾»ÊÕÈë"  {
local P034= x[`i']
}
if w[`i']=="ÒÑ×¬±£·Ñ"  {
local P035= x[`i']
}
if w[`i']=="±£ÏÕÒµÎñÊÕÈë"  {
local P036= x[`i']
}
if w[`i']=="·Ö±£·ÑÊÕÈë"  {
local P037= x[`i']
}
if w[`i']=="·Ö³ö±£·Ñ"  {
local P038= x[`i']
}
if w[`i']=="ÌáÈ¡Î´µ½ÆÚÔðÈÎ×¼±¸½ð"  {
local P039= x[`i']
}
if w[`i']=="ÍË±£½ð"  {
local P040= x[`i']
}
if w[`i']=="Åâ¸¶Ö§³ö"  {
local P041= x[`i']
}
if w[`i']=="Ì¯»ØÅâ¸¶Ö§³ö"  {
local P042= x[`i']
}
if w[`i']=="ÌáÈ¡±£ÏÕÔðÈÎ×¼±¸½ð"  {
local P043= x[`i']
}
if w[`i']=="Ì¯»Ø±£ÏÕÔðÈÎ×¼±¸½ð"  {
local P044= x[`i']
}
if w[`i']=="±£µ¥ºìÀûÖ§³ö"  {
local P045= x[`i']
}
if w[`i']=="·Ö±£·ÑÓÃ"  {
local P046= x[`i']
}
if w[`i']=="ÒµÎñ¼°¹ÜÀí·Ñ"  {
local P047= x[`i']
}
if w[`i']=="Ì¯»Ø·Ö±£·ÑÓÃ"  {
local P048= x[`i']
}
if w[`i']=="¿Í»§´æ¿îºÍÍ¬Òµ´æ·Å¿îÏî¾»Ôö¼Ó¶î"  {
local C068= x[`i']
}
if w[`i']=="ÏòÖÐÑëÒøÐÐ½è¿î¾»Ôö¼Ó¶î"  {
local C069= x[`i']
}
if w[`i']=="ÏòÆäËû½ðÈÚ»ú¹¹²ðÈë×Ê½ð¾»Ôö¼Ó¶î"  {
local C070= x[`i']
}
if w[`i']=="ÊÕÈ¡ÀûÏ¢¡¢ÊÖÐø·Ñ¼°Ó¶½ðµÄÏÖ½ð"  {
local C071= x[`i']
}
if w[`i']=="´¦ÖÃ½»Ò×ÐÔ½ðÈÚ×Ê²ú¾»Ôö¼Ó¶î"  {
local C072= x[`i']
}
if w[`i']=="²ðÈë×Ê½ð¾»Ôö¼Ó¶î"  {
local C073= x[`i']
}
if w[`i']=="»Ø¹ºÒµÎñ×Ê½ð¾»Ôö¼Ó¶î"  {
local C074= x[`i']
}
if w[`i']=="ÊÕµ½Ô­±£ÏÕºÏÍ¬±£·ÑÈ¡µÃµÄÏÖ½ð"  {
local C075= x[`i']
}
if w[`i']=="ÊÕµ½ÔÙ±£ÒµÎñÏÖ½ð¾»¶î"  {
local C076= x[`i']
}
if w[`i']=="±£»§´¢½ð¼°Í¶×Ê¿î¾»Ôö¼Ó¶î"  {
local C077= x[`i']
}
if w[`i']=="¿Í»§´û¿î¼°µæ¿î¾»Ôö¼Ó¶î"  {
local C078= x[`i']
}
if w[`i']=="´æ·ÅÖÐÑëÒøÐÐºÍÍ¬Òµ¿îÏî¾»Ôö¼Ó¶î"  {
local C079= x[`i']
}
if w[`i']=="Ö§¸¶µÄÊÖÐø·Ñ¼°Ó¶½ðµÄÏÖ½ð"  {
local C080= x[`i']
}
if w[`i']=="Ö§¸¶Ô­±£ÏÕºÏÍ¬Åâ¸¶¿îÏîµÄÏÖ½ð"  {
local C081= x[`i']
}
if w[`i']=="Ö§¸¶±£µ¥ºìÀûµÄÏÖ½ð"  {
local C082= x[`i']
}
if w[`i']=="ÖÊÑº´û¿î¾»Ôö¼Ó¶î"  {
local C083= x[`i']
}
  }

 #delimit ;

post account ("`stockcode'") ("`adate'")
(`A001')
(`A002')
(`A003')
(`A004')
(`A005')
(`A006')
(`A007')
(`A008')
(`A009')
(`A010')
(`A011')
(`A012')
(`A013')
(`A014')
(`A015')
(`A016')
(`A017')
(`A018')
(`A019')
(`A020')
(`A021')
(`A022')
(`A023')
(`A024')
(`A025')
(`A026')
(`A027')
(`A028')
(`A029')
(`A030')
(`A031')
(`A032')
(`A033')
(`A034')
(`A035')
(`A036')
(`A037')
(`A038')
(`A039')
(`A040')
(`A041')
(`A042')
(`A043')
(`A044')
(`A045')
(`A046')
(`A047')
(`A048')
(`A049')
(`A050')
(`A051')
(`A052')
(`A053')
(`A054')
(`A055')
(`A056')
(`A057')
(`A058')
(`A059')
(`A060')
(`A061')
(`A062')
(`A063')
(`A064')
(`A065')
(`A066')
(`A067')
(`A068')
(`A069')
(`A070')
(`A071')
(`A072')
(`A073')
(`A074')
(`A075')
(`A076')
(`A077')
(`A078')
(`A079')
(`A080')
(`A081')
(`A082')
(`A083')
(`A084')
(`A085')
(`A086')
(`A087')
(`A088')
(`A089')
(`A090')
(`A091')
(`A092')
(`A093')
(`A094')
(`A095')
(`A096')
(`A097')
(`A098')
(`A099')
(`A100')
(`A101')
(`A102')
(`A103')
(`A104')
(`A105')
(`A106')
(`A107')
(`A108')
(`P001')
(`P002')
(`P003')
(`P004')
(`P005')
(`P006')
(`P007')
(`P008')
(`P009')
(`P010')
(`P011')
(`P012')
(`P013')
(`P014')
(`P015')
(`P016')
(`P017')
(`P018')
(`P019')
(`P020')
(`P021')
(`P022')
(`P023')
(`P024')
(`P025')
(`P026')
(`P027')
(`P028')
(`P029')
(`P030')
(`P031')
(`P032')
(`P033')
(`P034')
(`P035')
(`P036')
(`P037')
(`P038')
(`P039')
(`P040')
(`P041')
(`P042')
(`P043')
(`P044')
(`P045')
(`P046')
(`P047')
(`P048')
(`C001')
(`C002')
(`C003')
(`C004')
(`C005')
(`C006')
(`C007')
(`C008')
(`C009')
(`C010')
(`C011')
(`C012')
(`C013')
(`C014')
(`C015')
(`C016')
(`C017')
(`C018')
(`C019')
(`C020')
(`C021')
(`C022')
(`C023')
(`C024')
(`C025')
(`C026')
(`C027')
(`C028')
(`C029')
(`C030')
(`C031')
(`C032')
(`C033')
(`C034')
(`C035')
(`C036')
(`C037')
(`C038')
(`C039')
(`C040')
(`C041')
(`C042')
(`C043')
(`C044')
(`C045')
(`C046')
(`C047')
(`C048')
(`C049')
(`C050')
(`C051')
(`C052')
(`C053')
(`C054')
(`C055')
(`C056')
(`C057')
(`C058')
(`C059')
(`C060')
(`C061')
(`C062')
(`C063')
(`C064')
(`C065')
(`C066')
(`C067')
(`C068')
(`C069')
(`C070')
(`C071')
(`C072')
(`C073')
(`C074')
(`C075')
(`C076')
(`C077')
(`C078')
(`C079')
(`C080')
(`C081')
(`C082')
(`C083');

#delimit cr
restore
di "You've got the `stockcode' 's financial data in `adate'"
}

postclose account
}
foreach code in `firms' {
  while length("`code'")<6 {
	   local code = "0"+"`code'"
	     }
capture use `"`path'/`code'"', clear
if _rc != 0 {
exit
}

label var A001"»õ±Ò×Ê½ð"
label var A002"½»Ò×ÐÔ½ðÈÚ×Ê²ú"
label var A003"Ó¦ÊÕÆ±¾Ý"
label var A004"Ó¦ÊÕÕË¿î"
label var A005"Ô¤¸¶¿îÏî"
label var A006"ÆäËûÓ¦ÊÕ¿î"
label var A007"Ó¦ÊÕ¹ØÁª¹«Ë¾¿î"
label var A008"Ó¦ÊÕÀûÏ¢"
label var A009"Ó¦ÊÕ¹ÉÀû"
label var A010"´æ»õ"
label var A011"ÏûºÄÐÔÉúÎï×Ê²ú"
label var A012"Ò»ÄêÄÚµ½ÆÚµÄ·ÇÁ÷¶¯×Ê²ú"
label var A013"ÆäËûÁ÷¶¯×Ê²ú"
label var A014"Á÷¶¯×Ê²úºÏ¼Æ"
label var A015"¿É¹©³öÊÛ½ðÈÚ×Ê²ú"
label var A016"³ÖÓÐÖÁµ½ÆÚÍ¶×Ê"
label var A017"³¤ÆÚÓ¦ÊÕ¿î"
label var A018"³¤ÆÚ¹ÉÈ¨Í¶×Ê"
label var A019"Í¶×ÊÐÔ·¿µØ²ú"
label var A020"¹Ì¶¨×Ê²ú"
label var A021"ÔÚ½¨¹¤³Ì"
label var A022"¹¤³ÌÎï×Ê"
label var A023"¹Ì¶¨×Ê²úÇåÀí"
label var A024"Éú²úÐÔÉúÎï×Ê²ú"
label var A025"ÓÍÆø×Ê²ú"
label var A026"ÎÞÐÎ×Ê²ú"
label var A027"¿ª·¢Ö§³ö"
label var A028"ÉÌÓþ"
label var A029"³¤ÆÚ´ýÌ¯·ÑÓÃ"
label var A030"µÝÑÓËùµÃË°×Ê²ú"
label var A031"ÆäËû·ÇÁ÷¶¯×Ê²ú"
label var A032"·ÇÁ÷¶¯×Ê²úºÏ¼Æ"
label var A033"×Ê²ú×Ü¼Æ"
label var A034"¶ÌÆÚ½è¿î"
label var A035"½»Ò×ÐÔ½ðÈÚ¸ºÕ®"
label var A036"Ó¦¸¶Æ±¾Ý"
label var A037"Ó¦¸¶ÕË¿î"
label var A038"Ô¤ÊÕ¿îÏî"
label var A039"Ó¦¸¶Ö°¹¤Ð½³ê"
label var A040"Ó¦½»Ë°·Ñ"
label var A041"Ó¦¸¶ÀûÏ¢"
label var A042"Ó¦¸¶¹ÉÀû"
label var A043"ÆäËûÓ¦¸¶¿î"
label var A044"Ó¦¸¶¹ØÁª¹«Ë¾¿î"
label var A045"Ò»ÄêÄÚµ½ÆÚµÄ·ÇÁ÷¶¯¸ºÕ®"
label var A046"ÆäËûÁ÷¶¯¸ºÕ®"
label var A047"Á÷¶¯¸ºÕ®ºÏ¼Æ"
label var A048"³¤ÆÚ½è¿î"
label var A049"Ó¦¸¶Õ®È¯"
label var A050"³¤ÆÚÓ¦¸¶¿î"
label var A051"×¨ÏîÓ¦¸¶¿î"
label var A052"Ô¤¼Æ¸ºÕ®"
label var A053"µÝÑÓËùµÃË°¸ºÕ®"
label var A054"ÆäËû·ÇÁ÷¶¯¸ºÕ®"
label var A055"·ÇÁ÷¶¯¸ºÕ®ºÏ¼Æ"
label var A056"¸ºÕ®ºÏ¼Æ"
label var A057"ÊµÊÕ×Ê±¾£¨»ò¹É±¾£©"
label var A058"×Ê±¾¹«»ý"
label var A059"Ó¯Óà¹«»ý"
label var A060"¿â´æ¹É"
label var A061"Î´·ÖÅäÀûÈó"
label var A062"ÉÙÊý¹É¶«È¨Òæ"
label var A063"Íâ±Ò±¨±íÕÛËã¼Û²î"
label var A064"·ÇÕý³£¾­ÓªÏîÄ¿ÊÕÒæµ÷Õû"
label var A065"¹éÊôÄ¸¹«Ë¾ËùÓÐÕßÈ¨Òæ£¨»ò¹É¶«È¨Òæ£©"
label var A066"ËùÓÐÕßÈ¨Òæ£¨»ò¹É¶«È¨Òæ£©ºÏ¼Æ"
label var P001"ÓªÒµÊÕÈë"
label var P002"ÓªÒµ³É±¾"
label var P003"ÓªÒµË°½ð¼°¸½¼Ó"
label var P004"ÏúÊÛ·ÑÓÃ"
label var P005"¹ÜÀí·ÑÓÃ"
label var P006"¿±Ì½·ÑÓÃ"
label var P007"²ÆÎñ·ÑÓÃ"
label var P008"×Ê²ú¼õÖµËðÊ§"
label var P009"¹«ÔÊ¼ÛÖµ±ä¶¯¾»ÊÕÒæ"
label var P010"Í¶×ÊÊÕÒæ"
label var P011"¶ÔÁªÓªÆóÒµºÍºÏÓªÆóÒµµÄÍ¶×ÊÊÕÒæ"
label var P012"Ó°ÏìÓªÒµÀûÈóµÄÆäËû¿ÆÄ¿"
label var P013"ÓªÒµÀûÈó"
label var P014"²¹ÌùÊÕÈë"
label var P015"ÓªÒµÍâÊÕÈë"
label var P016"ÓªÒµÍâÖ§³ö"
label var P017"·ÇÁ÷¶¯×Ê²ú´¦ÖÃ¾»ËðÊ§"
label var P018"Ó°ÏìÀûÈó×Ü¶îµÄÆäËû¿ÆÄ¿"
label var P019"ÀûÈó×Ü¶î"
label var P020"ËùµÃË°"
label var P021"Ó°Ïì¾»ÀûÈóµÄÆäËû¿ÆÄ¿"
label var P022"¾»ÀûÈó"
label var P023"¹éÊôÓÚÄ¸¹«Ë¾ËùÓÐÕßµÄ¾»ÀûÈó"
label var P024"ÉÙÊý¹É¶«ËðÒæ"
label var P025"Ã¿¹ÉÊÕÒæ"
label var P026"»ù±¾Ã¿¹ÉÊÕÒæ"
label var C001"¾­Óª»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿"
label var C002"ÏúÊÛÉÌÆ·¡¢Ìá¹©ÀÍÎñÊÕµ½µÄÏÖ½ð"
label var C003"ÊÕµ½µÄË°·Ñ·µ»¹"
label var C004"ÊÕµ½ÆäËûÓë¾­Óª»î¶¯ÓÐ¹ØµÄÏÖ½ð"
label var C005"¾­Óª»î¶¯ÏÖ½ðÁ÷ÈëÐ¡¼Æ"
label var C006"¹ºÂòÉÌÆ·¡¢½ÓÊÜÀÍÎñÖ§¸¶µÄÏÖ½ð"
label var C007"Ö§¸¶¸øÖ°¹¤ÒÔ¼°ÎªÖ°¹¤Ö§¸¶µÄÏÖ½ð"
label var C008"Ö§¸¶µÄ¸÷ÏîË°·Ñ"
label var C009"Ö§¸¶ÆäËûÓë¾­Óª»î¶¯ÓÐ¹ØµÄÏÖ½ð"
label var C010"¾­Óª»î¶¯ÏÖ½ðÁ÷³öÐ¡¼Æ"
label var C011"¾­Óª»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿¾»¶î"
label var C012"Í¶×Ê»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿"
label var C013"ÊÕ»ØÍ¶×ÊÊÕµ½µÄÏÖ½ð"
label var C014"È¡µÃÍ¶×ÊÊÕÒæÊÕµ½µÄÏÖ½ð"
label var C015"´¦ÖÃ¹Ì¶¨×Ê²ú¡¢ÎÞÐÎ×Ê²úºÍÆäËû³¤ÆÚ×Ê²úÊÕ»ØµÄÏÖ½ð¾»¶î"
label var C016"´¦ÖÃ×Ó¹«Ë¾¼°ÆäËûÓªÒµµ¥Î»ÊÕµ½µÄÏÖ½ð¾»¶î"
label var C017"ÊÕµ½ÆäËûÓëÍ¶×Ê»î¶¯ÓÐ¹ØµÄÏÖ½ð"
label var C018"Í¶×Ê»î¶¯ÏÖ½ðÁ÷ÈëÐ¡¼Æ"
label var C019"¹º½¨¹Ì¶¨×Ê²ú¡¢ÎÞÐÎ×Ê²úºÍÆäËû³¤ÆÚ×Ê²úÖ§¸¶µÄÏÖ½ð"
label var C020"Í¶×ÊÖ§¸¶µÄÏÖ½ð"
label var C021"È¡µÃ×Ó¹«Ë¾¼°ÆäËûÓªÒµµ¥Î»Ö§¸¶µÄÏÖ½ð¾»¶î"
label var C022"Ö§¸¶ÆäËûÓëÍ¶×Ê»î¶¯ÓÐ¹ØµÄÏÖ½ð"
label var C023"Í¶×Ê»î¶¯ÏÖ½ðÁ÷³öÐ¡¼Æ"
label var C024"Í¶×Ê»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿¾»¶î"
label var C025"³ï×Ê»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿"
label var C026"ÎüÊÕÍ¶×ÊÊÕµ½µÄÏÖ½ð"
label var C027"È¡µÃ½è¿îÊÕµ½µÄÏÖ½ð"
label var C028"ÊÕµ½ÆäËûÓë³ï×Ê»î¶¯ÓÐ¹ØµÄÏÖ½ð"
label var C029"³ï×Ê»î¶¯ÏÖ½ðÁ÷ÈëÐ¡¼Æ"
label var C030"³¥»¹Õ®ÎñÖ§¸¶µÄÏÖ½ð"
label var C031"·ÖÅä¹ÉÀû¡¢ÀûÈó»ò³¥¸¶ÀûÏ¢Ö§¸¶µÄÏÖ½ð"
label var C032"Ö§¸¶ÆäËûÓë³ï×Ê»î¶¯ÓÐ¹ØµÄÏÖ½ð"
label var C033"³ï×Ê»î¶¯ÏÖ½ðÁ÷³öÐ¡¼Æ"
label var C034"³ï×Ê»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿¾»¶î"
label var C035"»ãÂÊ±ä¶¯¶ÔÏÖ½ðµÄÓ°Ïì"
label var C036"ÆäËûÔ­Òò¶ÔÏÖ½ðµÄÓ°Ïì"
label var C037"ÏÖ½ð¼°ÏÖ½ðµÈ¼ÛÎï¾»Ôö¼Ó¶î"
label var C038"ÆÚ³õÏÖ½ð¼°ÏÖ½ðµÈ¼ÛÎïÓà¶î"
label var C039"ÆÚÄ©ÏÖ½ð¼°ÏÖ½ðµÈ¼ÛÎïÓà¶î"
label var C040"½«¾»ÀûÈóµ÷½ÚÎª¾­Óª»î¶¯ÏÖ½ðÁ÷Á¿"
label var C041"¾»ÀûÈó"
label var C042"×Ê²ú¼õÖµ×¼±¸"
label var C043"¹Ì¶¨×Ê²úÕÛ¾É¡¢ÓÍÆø×Ê²úÕÛºÄ¡¢Éú²úÐÔÉúÎï×Ê²úÕÛ¾É"
label var C044"ÎÞÐÎ×Ê²úÌ¯Ïú"
label var C045"³¤ÆÚ´ýÌ¯·ÑÓÃÌ¯Ïú"
label var C046"´¦ÖÃ¹Ì¶¨×Ê²ú¡¢ÎÞÐÎ×Ê²úºÍÆäËû³¤ÆÚ×Ê²úµÄËðÊ§"
label var C047"¹Ì¶¨×Ê²ú±¨·ÏËðÊ§"
label var C048"¹«ÔÊ¼ÛÖµ±ä¶¯ËðÊ§"
label var C049"²ÆÎñ·ÑÓÃ"
label var C050"Í¶×ÊËðÊ§"
label var C051"µÝÑÓËùµÃË°×Ê²ú¼õÉÙ"
label var C052"µÝÑÓËùµÃË°¸ºÕ®Ôö¼Ó"
label var C053"´æ»õµÄ¼õÉÙ"
label var C054"¾­ÓªÐÔÓ¦ÊÕÏîÄ¿µÄ¼õÉÙ"
label var C055"¾­ÓªÐÔÓ¦¸¶ÏîÄ¿µÄÔö¼Ó"
label var C056"ÆäËû"
label var C057"¾­Óª»î¶¯²úÉúµÄÏÖ½ðÁ÷Á¿¾»¶î2"
label var C058"²»Éæ¼°ÏÖ½ðÊÕÖ§µÄÖØ´óÍ¶×ÊºÍ³ï×Ê»î¶¯"
label var C059"Õ®Îñ×ªÎª×Ê±¾"
label var C060"Ò»ÄêÄÚµ½ÆÚµÄ¿É×ª»»¹«Ë¾Õ®È¯"
label var C061"ÈÚ×Ê×âÈë¹Ì¶¨×Ê²ú"
label var C062"ÏÖ½ð¼°ÏÖ½ðµÈ¼ÛÎï¾»±ä¶¯Çé¿ö"
label var C063"ÏÖ½ðµÄÆÚÄ©Óà¶î"
label var C064"ÏÖ½ðµÄÆÚ³õÓà¶î"
label var C065"ÏÖ½ðµÈ¼ÛÎïµÄÆÚÄ©Óà¶î"
label var C066"ÏÖ½ðµÈ¼ÛÎïµÄÆÚ³õÓà¶î"
label var C067"ÆäËûÔ­Òò¶ÔÏÖ½ðµÄÓ°Ïì2"
label var A067"ÏÖ½ð¼°´æ·ÅÍ¬Òµ¿îÏî"
label var A068"¿Í»§×Ê½ð´æ¿î"
label var A069"´æ·ÅÖÐÑëÒøÐÐ¿îÏî"
label var A070"½áËã±¸¸¶½ð"
label var A071"¿Í»§±¸¸¶½ð"
label var A072"¹ó½ðÊô"
label var A073"²ð³ö×Ê½ð"
label var A074"ÑÜÉú½ðÈÚ×Ê²ú"
label var A075"ÂòÈë·µÊÛ½ðÈÚ×Ê²ú"
label var A076"Ó¦ÊÕ±£·Ñ"
label var A077"Ó¦ÊÕ´úÎ»×·³¥¿î"
label var A078"Ó¦ÊÕ·Ö±£ÕÊ¿î"
label var A079"Ó¦ÊÕ·Ö±£Î´µ½ÆÚÔðÈÎ×¼±¸½ð"
label var A080"Ó¦ÊÕ·Ö±£Î´¾öÅâ¿î×¼±¸½ð"
label var A081"Ó¦ÊÕ·Ö±£ÊÙÏÕÔðÈÎ×¼±¸½ð"
label var A082"Ó¦ÊÕ·Ö±£³¤ÆÚ½¡¿µÏÕÔðÈÎ×¼±¸½ð"
label var A083"±£»§ÖÊÑº´û¿î"
label var A084"¶¨ÆÚ´æ¿î"
label var A085"·¢·Å´û¿î¼°µæ¿î"
label var A086"´æ³ö±£Ö¤½ð"
label var A087"´úÀíÒµÎñ×Ê²ú"
label var A088"½»Ò×Ï¯Î»·Ñ"
label var A089"¶ÀÁ¢ÕÊ»§×Ê²ú"
label var A090"ÏòÖÐÑëÒøÐÐ½è¿î"
label var A091"Í¬Òµ¼°ÆäËû½ðÈÚ»ú¹¹´æ·Å¿îÏî"
label var A092"ÖÊÑº½è¿î"
label var A093"²ðÈë×Ê½ð"
label var A094"ÑÜÉú½ðÈÚ¸ºÕ®"
label var A095"Âô³ö»Ø¹º½ðÈÚ×Ê²ú¿î"
label var A096"ÎüÊÕ´æ¿î"
label var A097"´úÀíÂòÂôÖ¤È¯¿î"
label var A098"´úÀí³ÐÏúÖ¤È¯¿î"
label var A099"Ô¤ÊÕ±£·Ñ"
label var A100"´úÀíÒµÎñ¸ºÕ®"
label var A101"Ó¦¸¶±£µ¥ºìÀû"
label var A102"±£»§´¢½ð¼°Í¶×Ê¿î"
label var A103"Î´µ½ÆÚÔðÈÎ×¼±¸½ð"
label var A104"Î´¾öÅâ¿î×¼±¸½ð"
label var A105"ÊÙÏÕÔðÈÎ×¼±¸½ð"
label var A106"³¤ÆÚ½¡¿µÏÕÔðÈÎ×¼±¸½ð"
label var A107"¶ÀÁ¢ÕÊ»§¸ºÕ®"
label var A108"Ò»°ã·çÏÕ×¼±¸"
label var P027"ÀûÏ¢¾»ÊÕÈë"
label var P028"ÀûÏ¢ÊÕÈë"
label var P029"ÀûÏ¢Ö§³ö"
label var P030"ÊÖÐø·Ñ¼°Ó¶½ð¾»ÊÕÈë"
label var P031"ÊÖÐø·Ñ¼°Ó¶½ðÊÕÈë"
label var P032"´úÀíÂòÂôÖ¤È¯ÒµÎñ¾»ÊÕÈë"
label var P033"Ö¤È¯³ÐÏúÒµÎñ¾»ÊÕÈë"
label var P034"Î¯ÍÐ¿Í»§¹ÜÀí×Ê²úÒµÎñ¾»ÊÕÈë"
label var P035"ÒÑ×¬±£·Ñ"
label var P036"±£ÏÕÒµÎñÊÕÈë"
label var P037"·Ö±£·ÑÊÕÈë"
label var P038"·Ö³ö±£·Ñ"
label var P039"ÌáÈ¡Î´µ½ÆÚÔðÈÎ×¼±¸½ð"
label var P040"ÍË±£½ð"
label var P041"Åâ¸¶Ö§³ö"
label var P042"Ì¯»ØÅâ¸¶Ö§³ö"
label var P043"ÌáÈ¡±£ÏÕÔðÈÎ×¼±¸½ð"
label var P044"Ì¯»Ø±£ÏÕÔðÈÎ×¼±¸½ð"
label var P045"±£µ¥ºìÀûÖ§³ö"
label var P046"·Ö±£·ÑÓÃ"
label var P047"ÒµÎñ¼°¹ÜÀí·Ñ"
label var P048"Ì¯»Ø·Ö±£·ÑÓÃ"
label var C068"¿Í»§´æ¿îºÍÍ¬Òµ´æ·Å¿îÏî¾»Ôö¼Ó¶î"
label var C069"ÏòÖÐÑëÒøÐÐ½è¿î¾»Ôö¼Ó¶î"
label var C070"ÏòÆäËû½ðÈÚ»ú¹¹²ðÈë×Ê½ð¾»Ôö¼Ó¶î"
label var C071"ÊÕÈ¡ÀûÏ¢¡¢ÊÖÐø·Ñ¼°Ó¶½ðµÄÏÖ½ð"
label var C072"´¦ÖÃ½»Ò×ÐÔ½ðÈÚ×Ê²ú¾»Ôö¼Ó¶î"
label var C073"²ðÈë×Ê½ð¾»Ôö¼Ó¶î"
label var C074"»Ø¹ºÒµÎñ×Ê½ð¾»Ôö¼Ó¶î"
label var C075"ÊÕµ½Ô­±£ÏÕºÏÍ¬±£·ÑÈ¡µÃµÄÏÖ½ð"
label var C076"ÊÕµ½ÔÙ±£ÒµÎñÏÖ½ð¾»¶î"
label var C077"±£»§´¢½ð¼°Í¶×Ê¿î¾»Ôö¼Ó¶î"
label var C078"¿Í»§´û¿î¼°µæ¿î¾»Ôö¼Ó¶î"
label var C079"´æ·ÅÖÐÑëÒøÐÐºÍÍ¬Òµ¿îÏî¾»Ôö¼Ó¶î"
label var C080"Ö§¸¶µÄÊÖÐø·Ñ¼°Ó¶½ðµÄÏÖ½ð"
label var C081"Ö§¸¶Ô­±£ÏÕºÏÍ¬Åâ¸¶¿îÏîµÄÏÖ½ð"
label var C082"Ö§¸¶±£µ¥ºìÀûµÄÏÖ½ð"
label var C083"ÖÊÑº´û¿î¾»Ôö¼Ó¶î"
save,replace
if c(stata_version) >= 14 {
	qui {
	clear
	local path2="`c(pwd)'"
	cd "`path'"
	unicode encoding set gb18030
	unicode translate `code'.dta,transutf8
	unicode erasebackups,badidea
	cd "`path2'"
	use "`path'/`code'"
	save,replace
	}

}
}

	erase `path'\lr.dta
	erase `path'\zcfz.dta
	erase `path'\xjll.dta
	di "finished"
	di "Your finacial data have been saved in `path'"
end

version 12
capture mata mata drop gdate()
capture mata mata drop _cnaccount()
mata:
void function gdate(
     string scalar dfile,
	 string scalar date)
{
        line0 = cat(dfile)
        line = select(line0,strpos(line0,`"<script type="text/javascript">dateurl="'))
        line = subinstr(line,`"<script type="text/javascript">dateurl="char((104,116,116,112,58,47,47)stockdata.stock.char((104, 101, 120,117,110)).com/2008/lr.aspx?stockid="',"")
		line2 = subinstr(subinstr(line, `"]];</script>"', ""), `"],["',",")
		line3 = subinstr(line2," ","")
		line4 = subinstr(line3,","," ")
		v = tokens(line4, " ")'
		st_sview(x=.,.,date)
		x[1..rows(v)] = v

	}

void function _cnaccount(
		string scalar pfile,
		string scalar cfile,
		string scalar bfile,
		string scalar vn)

{
        line0 = cat(pfile)
        line = select(line0,strpos(line0,`"<span id="ControlEx1_lbl">"'))
        line = subinstr(line,`"<span id="ControlEx1_lbl"><tr><td class='dotborder' width='45%'><div class='tishi'><strong>"',"")
		line = subinstr(subinstr(line, `"</div></td></span>"', ""), `"</strong></div></td><td><div class='tishi'>"'," ")
		line = subinstr(line, `"</div></td><tr><td class='dotborder' width='45%'><div class='tishi'><strong>"', " ")
		v=tokens(line, " ")'
		profit=v[(3::rows(v)),.]
		ROW=2*floor(rows(profit)/2)
		profit=v[(3::ROW),.]


        line0 = cat(cfile)
        line = select(line0,strpos(line0,`"<span id="ControlEx1_lbl">"'))
        line = subinstr(line,`"<span id="ControlEx1_lbl"><tr><td class='dotborder' width='45%'><div class='tishi'><strong>"',"")
		line = subinstr(subinstr(line, `"</div></td></span>"', ""), `"</strong></div></td><td><div class='tishi'>"'," ")
		line =  subinstr(line, `"</div></td><tr><td class='dotborder' width='45%'><div class='tishi'><strong>"', " ")
		line =  subinstr(line, `"</div></td><tr><td height='1' colspan='2' bgcolor='#cfcfcf'></td></tr><tr><td colspan='2' class='lastbgcolor'><div class='tishi'><strong>"', " ")
		line =  subinstr(line, `"</strong></div></td></tr><tr><td height='1' colspan='2' bgcolor='#cfcfcf'></td></tr><tr><td class='dotborder' width='45%'><div class='tishi'><strong>"', " --  ")
		line =  subinstr(line, `"</strong></div></td></tr><tr><td height='1' colspan='2' bgcolor='#cfcfcf'></td></tr><tr><td height='1' colspan='2' bgcolor='#cfcfcf'></td></tr><tr><td colspan='2' class='lastbgcolor'><div class='tishi'><strong>"', " --  ")

		v=tokens(line, " ")'
		cashflow=v[(3::rows(v)),.]
		ROW=2*floor(rows(cashflow)/2)
		cashflow=v[(3::ROW),.]

        line0 = cat(bfile)
        line = select(line0,strpos(line0,`"<span id="ControlEx1_lbl">"'))
        line = subinstr(line,`"<span id="ControlEx1_lbl"><tr><td class='dotborder' width='45%'><div class='tishi'><strong>"',"")
		line = subinstr(subinstr(line, `"</div></td></span>"', ""), `"</strong></div></td><td><div class='tishi'>"'," ")
		line =  subinstr(line, `"</div></td><tr><td class='dotborder' width='45%'><div class='tishi'><strong>"', " ")
		v=tokens(line, " ")'
		balance=v[(3::rows(v)),.]
		ROW=2*floor(rows(balance)/2)
		balance=v[(1::ROW),.]


		account= balance\ profit \ cashflow

  		st_sview(x=.,.,vn)
  		x[1..rows(account)] = account
}
end