-------------------------------------------------------------------------------
help for toroman
-------------------------------------------------------------------------------

Conversion of decimal numbers to Roman numerals

toroman numvar [if exp] [in range] , generate(romanvar) [lower]

Description

toroman creates a string variable romanvar containing Roman numerals from a numeric variable numvar following these rules:

1. Negative, zero and fractional numbers are ignored.

2. The conversion uses M, D, C, L, X, V, I to represent 1000, 500, 100, 50, 10, 5, 1 as many times as they occur, except that CM, CD, XC, XL, IX, IV are used to represent 900, 400, 90, 40, 9, 4.

3. No number that is 233888 or greater is converted. This limit is implied by the limits on string variables, so that using these rules any number greater than 244000 (and some numbers less than that) could not be stored as Roman numerals in a Stata string variable. (The smallest problematic number is 233888, which would convert to a Roman numeral consisting of 233 Ms followed by DCCCLXXXVIII, i.e. a numeral 245 characters long.) See help on data types.

Options

generate() specifies the name of the new string variable to be created and is not optional.

lower specifies that numerals are to be produced as lower case letters, such as mmxi rather than MMXI.

Examples

. toroman numeq, gen(roman)

Acknowledgments

Peter A. [Tony] Lachenbruch suggested the reverse problem on Statalist.

Author

Nicholas J. Cox, Durham University, U.K. n.j.cox@durham.ac.uk

Also see

Online: help for fromroman