.- help for ^conv2num^ (STB-29: dm40) .- Converting string variables to numeric variables ------------------------------------------------ ^conv2num^ strvar [^,^ ^noc^ompress ^g^enerate^(^numvar^)^ ^l^abel^(^str^)^ ] Description ----------- ^conv2num^ adds some convenience features to Stata's ^real()^ function, the function that converts a string representation of a number to a numeric value. ^conv2num^ eliminates non-numeric suffixes, such as ^%^, that are added by spreadsheets and other programs. ^conv2num^ also compresses the result into the smallest numeric data type that can hold the result. Completely non-numeric values are converted to missing values. If only ^strvar^ is specified, it is converted to a numeric variable in place. If ^numvar^ is specified, a new, numeric variable of that name is generated and ^strvar^ is left as is. By default, the new variable receives the variable label of the original string variable. If ^label()^ is specified, it is used in place of the original variable label. ^conv2num^ uses ^real()^ to perform the conversions, hence, any precision limitations of ^real()^ are also limitations of ^conv2num^. Options ------- ^noc^ompress suppresses the compression of the numeric variable. ^g^enerate^(^numvar^)^ specifies the name of the numeric variable. If this option is not specified, ^strvar^ is converted in place. ^l^abel^(^str^)^ specifies a new variable label for ^numvar^. By default, the label of ^strvar^ is copied. Example ------- . ^conv2num strvar, generate(numvar) label("Numeric variable")^ Author ------ Robert M. Farmer rfarmer@@aqaf.com Also see -------- STB: STB-29 dm40 Manual: [2] datatypes, [2] functions