This paper describes the design of a statistical expert system STATEX. Statistical program in STATEX is considered as a sequence of capsules calculating statistics. The insides of the capsules are not open to statistical analysts but the definitions and the meanings of the statistics calculated by the capsules are open to them. STATEX can automatically generate statistical programs based on the numerical definition for each capsule and a sequence of capsules with loops and branches. STATEX has various statistical knowledges; purposes for statistical analysis, statistics, statistical methods, conditions for loops and branches, massages from statistical programs, responses of statistical analysts, and examples of statistical analyses. Statistical method developers store most of the statistical knowledge in order to develop statistical programs. Hence STATEX makes easy statistical knowledge acquisition. STATEX supports statistically naive users to analyze statistical data by the functions; selection of the optimum statistical method, explanation of statistics and statistical methods including the flow of a statistical program, and display of examples of statistical analyses. The function of automatic program generation in STATEX supports non-programers to develop/modify statistical programs without any programing tequnique. We have already developed the functions of method selection and automatic program generation.