Transcription of Creating new variables - Stata
{{id}} {{{paragraph}}}
11 Creating new variablesgenerate and replaceThis chapter shows the basics of Creating and modifying variables in Stata . We saw how to workwith the Data Editor in[GSW] 6 Using the Data Editor this chapter shows how we would do thisfrom the Command window. The two primary commands used for this are generatefor Creating new variables . It has a minimum abbreviation ofg. replacefor replacing the values of an existing variable . It may not be abbreviated because italters existing data and hence can be considered most basic form for Creating new variables isgeneratenewvar=exp, whereexpis any kindofexpression. Of course, bothgenerateandreplacecan be used withifandinqualifiers. Anexpression is a formula made up of constants, existing variables , operators, and functions.
The encode command turns categorical string variables into encoded numeric variables, while its counterpart decode reverses this operation. See[D] encode for more information. The destring command turns string variables that should be numeric, such as numbers with currency symbols, into numbers. To go from numbers to strings, the tostring ...
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}