Title

rollbook -- Student sampling program for class roll management

Description

rollbook is a Stata program designed to facilitate student sampling from class roll Excel files.
It provides multiple sampling methods including random sampling, sampling by serial number,
sampling by student ID parity (odd/even), and sampling by major. The program reads Excel files
with specific column names (序号, 学号, 姓名, 专业) and displays the sampling results in a formatted output.

Syntax

rollbook using filename, [n(integer) serial(string) even(string) major(string) sheet(string)]

n(integer) Specifies the number of students to randomly sample

serial(string) Specifies serial numbers to select (space-separated)

even(string) Selects students based on student ID parity ("odd" or "even")

major(string) Selects students from a specific major

sheet(string) Specifies the worksheet name to read from Excel file

Options

n(integer) specifies the number of students to randomly sample from the roll.
This option is required when no other selection method is specified.

serial(string) allows selection of specific students by their serial numbers.
Multiple serial numbers can be provided as a space-separated list.

even(string) selects students based on the parity (odd or even) of the last digit
of their student ID. Valid values are "odd" or "even".

major(string) selects all students from a specified major.

sheet(string) specifies the worksheet name to read from the Excel file. If not specified,
the program will read the first worksheet by default. This is useful when the Excel file contains multiple worksheets.

Examples

. rollbook using "rollbook.xlsx", n(5)

Randomly samples 5 students from the Excel file.

. rollbook using "rollbook.xlsx", serial(8 18)

Selects students with serial numbers 8 and 18.

. rollbook using "rollbook.xlsx", even(odd)

Selects students whose student ID ends with an odd digit.

. rollbook using "rollbook.xlsx", major("Accounting")

Selects all students from the "Accounting" major.

. rollbook using "rollbook.xlsx", sheet("ClassA") n(3)

Randomly samples 3 students from the "ClassA" worksheet in the Excel file.

. rollbook using "rollbook.xlsx", sheet("ClassB") major("Finance")

Selects all Finance major students from the "ClassB" worksheet.

Required Excel Format

The Excel file must contain the following columns with these exact names (in Chinese):

序号 (Serial number)

学号 (Student ID)

姓名 (Name)

专业 (Major)

File Location

The program expects the rollbook.xlsx file to be located in the current working directory.
If the file is not found, the program will display an error message with instructions.

Authors

Wu Lianghai

School of Business, Anhui University of Technology (AHUT)

Ma'anshan, China

E-mail: agd2010@yeah.net

Chen Liwen

School of Business, Anhui University of Technology (AHUT)

Ma'anshan, China

E-mail: 2184844526@qq.com

Hu Fangfang

School of Finance and Economics, Wanjiang University of Technology (WJUT)

Ma'anshan, China

E-mail: huff470@163.com

Jin Xuening

School of Business, Anhui University of Technology (AHUT)

Ma'anshan, China

E-mail: 1418924481@qq.com

Also see

import excel for importing Excel files into Stata

sample for Stata's built-in sampling command

[file content end]