Virata manual

edit

Opens the data viewer, the same window browse opens.

What we have

  • opening the data viewer, the same window browse opens
  • a varlist, if and in

Coming later

  • changing values, which is what edit is for in Stata; use replace
  • sorting and filtering inside the viewer

You may shorten it to ed.

How you write it

edit [varlist] [if] [in]

Square brackets mean optional. A vertical bar means choose one.

What it does

In Stata, edit opens the data editor and you can type new values into the cells. Virata's viewer is read-only: edit shows you the same window browse does, and nothing you do in it changes the data.

That is a real difference and worth knowing before you go looking for a cell to click in. To change values, use the commands that do it in writing — replace, generate, recode — which have the advantage that a do-file records exactly what you changed and why.

Like browse, it takes a varlist, if and in, so edit age if age > 60 opens the viewer showing just those rows of that column.

Watch out. The viewer is read-only. Nothing you do in that window changes the data, so a value that looks wrong has to be fixed with replace.

Try it

Every example below was run after sysuse vira.sample02, clear.

. edit
       village      stratum      state  sector  sex  age  education  hhsize     mpce    wage  multiplier
     ---------------------------------------------------------------------------------------------------
   1.       52  Rajasthan-1  Rajasthan       1    1   57          4       3  2526.16       .      1619.3
   2.       86     Odisha-1     Odisha       1    1   71         13       8  3250.25  845.25      2247.3
   3.       57     Kerala-1     Kerala       1    2   72          3       3  3247.12     408      1681.7
   4.      142     Odisha-1     Odisha       1    1   16          5       1  2346.14       .        2657
   5.      203  Rajasthan-2  Rajasthan       2    1   38         14       6     2978  642.18      1237.9
   6.      120  Rajasthan-2  Rajasthan       2    2   57         15       3  3665.13  583.53      1643.4
   7.      330  Rajasthan-2  Rajasthan       2    1   16         13       8  4919.31  509.12      1394.4
   8.      219  Rajasthan-2  Rajasthan       2    2   36          2       4  3416.58       .       905.9
   9.      355     Kerala-1     Kerala       1    2   44          2       4  2524.66  331.26      1921.2
  10.       81    Gujarat-1    Gujarat       1    1   25         11       4  3455.13  556.11        1999
  11.      275      Bihar-1      Bihar       1    2   61          5       5  3420.83   495.3      1590.3
  12.      238      Bihar-1      Bihar       1    1   65          5       4  4727.98  431.15      1958.5
  13.      225    Gujarat-2    Gujarat       2    1   18          4       1  7352.52  428.51      1226.1
  14.      373     Odisha-1     Odisha       1    2   65          4       7  1965.89  550.15      2514.3
  15.      288  Rajasthan-1  Rajasthan       1    2   42          2       1  2089.44       .      1930.8
  16.      111     Punjab-1     Punjab       1    2   79          1       8   3204.5  386.46        1797
  17.      358    Gujarat-1    Gujarat       1    2   43          4       4  4141.33  330.29      1955.2
  18.      215     Punjab-1     Punjab       1    2   68          8       1  3221.44  558.36      2163.4
  19.      317     Odisha-2     Odisha       2    2   40         12       5  2661.65  443.61      1505.8
  20.      129     Kerala-1     Kerala       1    1   62         13       1  5162.62   689.3      1881.6
  21.      379    Gujarat-1    Gujarat       1    2   41          4       8  1788.08       .        1858
  22.      276  Rajasthan-1  Rajasthan       1    1   71          0       5  1961.28  456.23      1660.6
  23.      171     Odisha-2     Odisha       2    1   37          8       5   4923.2  530.56      1250.1
  24.       19     Kerala-1     Kerala       1    1   67          9       6  2271.21  653.14      1638.7
  25.      396      Bihar-1      Bihar       1    2   41          0       4  2947.89   271.3      2582.1
  26.      220  Rajasthan-1  Rajasthan       1    1   59          2       8  2840.11  480.13      1785.3
  27.      343     Punjab-2     Punjab       2    1   53          5       1  3310.42  479.77      1140.1
  28.      286  Rajasthan-1  Rajasthan       1    1   15          2       6   3260.6   317.6      2128.6
  29.      172     Punjab-2     Punjab       2    2   72         15       2   6649.5  799.01      1179.9
  30.      242      Bihar-2      Bihar       2    2   49         14       1  2844.11  718.35      1444.5
  31.      141    Gujarat-1    Gujarat       1    1   52         13       7   3932.2  702.32        2405
  32.      267    Gujarat-1    Gujarat       1    1   55          5       5  3120.92  532.01      2686.4
  33.       81    Gujarat-1    Gujarat       1    2   70          5       1  2457.68       .      1812.1
  34.      177    Gujarat-2    Gujarat       2    1   54          4       4  2601.56   414.9      1918.2
  35.      138  Rajasthan-1  Rajasthan       1    2   72         13       4  3953.41       .      2054.1
  36.      166     Punjab-1     Punjab       1    1   40          7       6  2763.97  443.17      2002.5
  37.       58     Kerala-1     Kerala       1    1   33          0       3  1685.53  302.57      2087.3
  38.      157  Rajasthan-2  Rajasthan       2    2   46          3       1  2618.02  379.42      1252.4
  39.      200    Gujarat-2    Gujarat       2    2   76         15       8  8972.77       .      1579.3
  40.      217     Kerala-2     Kerala       2    2   58          3       2  5774.25  405.24      1096.9
  41.       35      Bihar-2      Bihar       2    2   56          3       5  2544.07       .        1309
  42.      344     Odisha-1     Odisha       1    1   70          9       8  3301.18       .      2097.9
  43.      367      Bihar-1      Bihar       1    1   62         15       8  2509.28       .      1476.5
  44.      167     Odisha-2     Odisha       2    2   24          6       7  2317.66  391.52      1221.5
  45.       40     Odisha-2     Odisha       2    1   67         13       3  2779.03  769.17      1299.3
  46.      106     Odisha-1     Odisha       1    2   27          2       5  1584.05       .      1999.8
  47.       15     Punjab-2     Punjab       2    2   15          4       3  3582.09  275.63      1399.7
  48.       94     Punjab-1     Punjab       1    1   67          9       1  3370.31  614.96      2069.7
  49.      324      Bihar-1      Bihar       1    1   27          8       7     1816  467.87      1604.9
  50.      170     Punjab-2     Punjab       2    1   70          0       4  4485.42  462.87      1426.6
(only the first 50 observations shown; use `in` for more)
The same thing in pandas and in R

pandas

df[['village', 'stratum', 'state', 'sector', 'sex', 'age', 'education', 'hhsize', 'mpce', 'wage', 'multiplier']].head()

R

# no R form for `edit` yet -- see docs/r-equivalents.md

Nearby

use save sysuse import export clear