Virata manual

Making and changing variables

Adding columns, fixing values, renaming, sorting, labelling.

What we have

  • Adds a new column, worked out from the ones you already have.
  • Changes values in a column you already have.
  • Adds a column holding a group summary — the group's average, total, biggest.
  • Turns values into other values by rule — ages into age bands, say.
  • Gives a column a different name.
  • Moves columns to the front so they are the first thing you see.
  • Removes columns, or removes rows.
  • The opposite of drop: keeps only what you name and removes the rest.
  • Puts the rows in order, smallest first.
  • Sorts with a direction you choose for each column.
  • Attaches readable text to a column, or to the codes inside it.
  • Turns a text column into numbered categories.
  • Turns a coded number back into the words it stands for.
  • Turns a column of text that is really numbers into actual numbers.
  • Turns a number column into text.
  • Takes a snapshot of the data so you can get it back.
  • Puts back the data that preserve saved.

Coming later

  • Stata's bysort x (y):, which sorts within the group on the same line — use sort then by
  • format(), to control how the number is written out
  • format — there is no way to set how a number prints
  • label language, for more than one set of labels at a time
  • label() — accepted, but the label set is still named after the new variable
  • order, alphabetic
  • pctile(), rank(), cut() and the rest of Stata's egen library
  • recode's label options, which name the new categories as they are made
  • runiform() and the other random-number functions
  • renaming several at once, as rename (a b) (c d)