Skip to Main Content

How can I input a small dataset quickly? | Stata FAQ

The answer to this question involves the use of the input command.

Let’s say that you want to enter the following data:









x  y
32 56
26 67
34 61
39 58
29 58


Here is how you would do it:

input x y
32 56
26 67
34 61
39 58
29 58
end

list

             x          y 
  1.        32         56  
  2.        26         67  
  3.        34         61  
  4.        39         58  
  5.        29         58  
 
summarize

Variable |     Obs        Mean   Std. Dev.       Min        Max
---------+-----------------------------------------------------
       x |       5          32   4.949747         26         39  
       y |       5          60   4.301163         56         67

Note: You wouldn’t
want to use this method with anything other than a very small dataset.
With a larger dataset you might want to use Stata’s editor (edit
command), the infile command or the insheet command.

For More Information