fs
fs lists the names of files in compact form. With no arguments, fs lists names of files in the current directory or folder. Otherwise, it follows file specifications. A file specification is a filename or (more commonly) a set of filenames indicated by the use of wildcards * or ?. folders is similar, but works for folders (or directories).
公卫百科
公卫家园
公卫人
安装:ssc install fs
公卫百科
案例:
I want to combine many .csv files. Each file has the name NYSEyyyymmdd.csv, where yyyymmdd is the date. For example yyyy= 1996, mm is month, e.g 01 for january, and dd is day, e.g. 01 for the first day of the month. The data are stock prices each day when the exchange is open, so even though the file names increases, there will be gaps for weekends, holidays, etc.
公卫考场
ssc inst fs
cd D:\NYSE
fs NYSE_*.csv
foreach f in `r(files)' {
insheet using "`f'", clear
local ID : subinstr local f "NYSE_" "", all
gen id = "`ID'"
save file`i', replace
}
公卫百科
附件列表
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。