11.07.2015 Views

[U] User's Guide

[U] User's Guide

[U] User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

[ U ] 11.1 Overview 91Example 7Negative in ranges can be useful with sort. For instance, we have data on automobiles and wishto list the five with the highest mileage ratings:. use http://www.stata-press.com/data/r11/auto(1978 Automobile Data). sort mpg. list make mpg in -5/lmakempg70. Toyota Corolla 3171. Plym. Champ 3472. Subaru 3573. Datsun 210 3574. VW Diesel 4111.1.5 =exp=exp specifies the value to be assigned to a variable and is most often used with generate andreplace. See [U] 13 Functions and expressions for details on expressions and [D] generate fordetails on the generate and replace commands.Example 8Expressiongenerate newvar=oldvar+2replace oldvar=oldvar+2egen newvar=rank(oldvar)Meaningcreates a new variable named newvarequal to oldvar+2changes the contents of the existing variableoldvarcreates newvar containing the ranks ofoldvar (see [D] egen)11.1.6 weightweight indicates the weight to be attached to each observation. The syntax of weight is[weightword=exp]where you actually type the square brackets and where weightword is one ofweightwordMeaningweightfweight or frequencypweightaweight or cellsizeiweightdefault treatment of weightsfrequency weightssampling weightsanalytic weightsimportance weightsThe underlining indicates the minimum acceptable abbreviation. Thus weight may be abbreviated wor we, etc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!