Example: bankruptcy

Introducing Stata—sample session

1 Introducing stata sample sessionIntroducing StataThis chapter will run through a sample work session , Introducing you to a few of the basic tasksthat can be done in stata , such as opening a dataset, investigating the contents of the dataset, usingsome descriptive statistics, making some graphs, and doing a simple regression analysis. As youwould expect, we will only brush the surface of many of these topics. This approach should give youa sample of what stata can do and how stata works. There will be brief explanations along the way,with references to chapters later in this book as well as to the system help and other stata will run through the session by using both menus and dialogs and stata s commands so that youcan become familiar with them a seat at your computer, put on some good music, and work along with the sessionThe dataset that we will use for this session is a set of data about vintage 1978 automobiles soldin the United follow along by pointing and clicking, note that the menu items are given byMenu > MenuItem > Submenu Item > etc.

1 Introducing Stata—sample session Introducing Stata This chapter will run through a sample work session, introducing you to a few of the basic tasks that can be done in Stata, such as opening a dataset, investigating the contents of the dataset, using some descriptive statistics, making some graphs, and doing a simple regression analysis. As you

Tags:

  Stata

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Introducing Stata—sample session

1 1 Introducing stata sample sessionIntroducing StataThis chapter will run through a sample work session , Introducing you to a few of the basic tasksthat can be done in stata , such as opening a dataset, investigating the contents of the dataset, usingsome descriptive statistics, making some graphs, and doing a simple regression analysis. As youwould expect, we will only brush the surface of many of these topics. This approach should give youa sample of what stata can do and how stata works. There will be brief explanations along the way,with references to chapters later in this book as well as to the system help and other stata will run through the session by using both menus and dialogs and stata s commands so that youcan become familiar with them a seat at your computer, put on some good music, and work along with the sessionThe dataset that we will use for this session is a set of data about vintage 1978 automobiles soldin the United follow along by pointing and clicking, note that the menu items are given byMenu > MenuItem > Submenu Item > etc.

2 To follow along by using the Command window, type the commandsthat follow a dot (.) in the boxed listings below into the small window labeledCommand. Whenthere is something of note about the structure of a command, it will be pointed out as a Syntaxnote .Start by loading theautodataset, which is included with stata . To use the menus,1. SelectFile > Example Click onExample datasets installed with Click result of this command is fourfold: The following output appears in the large Results window: . sysuse (1978 Automobile Data) The output consists of a command and its result. The command,sysuse , is boldand follows the period (.). The result,(1978 Automobile Data), is in the standard facehere and is a brief description of the : If a command intrigues you, you can typehelpcommandnamein the Command windowto find help.

3 If you want to explore at any time,Help > be informative. The same command,sysuse , appears in the tall Review window to the left. TheReview window keeps track of all commands stata has run, successful and unsuccessful. Thecommands can then easily be rerun. See[GSW] 2 The stata user interfacefor more information. A series of variables appears in the small Variables window to the upper [ GSW ] 1 Introducing stata sample session Some information aboutmake, the first variable in the dataset, appears in the small Propertieswindow to the lower could have opened the dataset by typingsysuse autoin the Command window and pressingEnter. Try this a command that loads (uses) example (system) datasets. As you willsee during this session , stata commands are often simple enough that it is faster to use them will be especially true once you become familiar with the commands you use the most in yourdaily use of note: In the above example,sysuseis the stata command, whereasautois the name ofa stata data data managementWe can get a quick glimpse at the data by browsing them in theData Editor.

4 This can be doneby clicking on theData Editor (Browse)button,, or by selectingData > Data Editor > DataEditor (Browse)from the menus or by typing the note: Here the command isbrowseand there are no other the Data Editor opens, you can see that stata regards the data as one rectangular table. Thisis true for all stata datasets. The columns representvariables, whereas the rows variables have somewhat descriptive names, whereas the observations are data are displayed in multiple colors at first glance, it appears that the variables listed in blackare numeric, whereas those that are in colors are text. This is worth investigating. Click on a cellunder themakevariable: the input box at the top displays the make of the car. Scroll to the right untilyou see theforeignvariable.

5 Click on one of its cells. Although the cell may display Domestic ,the input box displays a 0. This shows that stata can store categorical data as numbers but displayhuman-readable text. This is done by what stata callsvalue labels. Finally, under therep78variable,which looks to be numeric, there are some cells containing just a period (.). The periods correspondto missing values.[ GSW ] 1 Introducing stata sample session 3 Looking at the data in this fashion, though comfortable, lends little information about the would be useful for us to get more details about what the data are and how the data are the Data Editor by clicking on its close can see the structure of the dataset bydescribingits contents. This can be done either bygoing toData > Describe data > Describe data in memory or in a filein the menus and clickingonOKor by typingdescribein the Command window and pressingEnter.

6 Regardless of whichmethod you choose, you will get the same result: . describeContains data fromC:\Program Files\Stata13/ado/base/ :74 1978 Automobile Datavars:12 13 Apr 2013 17:45size.

7 3,182 (_dta has notes)storage display valuevariable name type format label variable labelmakestr18 %-18sMake and Modelpriceint % % (mpg)rep78int % Record 1978headroomfloat % (in.)trunkint % space (cu. ft.)weightint % (lbs.)

8 Lengthint % (in.)turnint % Circle (ft.)displacementint % (cu. in.)gear_ratiofloat % Ratioforeignbyte % originCar typeSorted by:foreign If your listing stops short, and you see a bluemoreat the base of the Results window, pressingthe Spacebar or clicking on the bluemoreitself will allow the command to be the top of the listing, some information is given about the dataset, such as where it is stored ondisk, how much memory it occupies, and when the data were last saved. The bold1978 AutomobileDatais the short description that appeared when the dataset was opened and is referred to as adatalabelby stata . The phrase_dta has notesinforms us that there are notes attached to the can see what notes there are by typingnotesin the Command window.

9 Notes_dta:1. from Consumer Reports with permission Here we see a short note about the source of the back at the listing fromdescribe, we can see that stata keeps track of more than justthe raw data. Each variable has the following: Avariable name, which is what you call the variable when communicating with stata . Variablenames are one type of stata name. See[U] Naming conventions. Astorage type, which is the way stata stores its data. For our purposes, it is enough to knowthat types like, say,strnumberarestring, or text, variables, whereas all others in this dataset4 [ GSW ] 1 Introducing stata sample sessionare numeric. While there are none in this dataset, stata also allows arbitrarily long strings, can even contain binary information. See[U] Strings. Adisplay format, which controls how stata displays the data in tables.

10 See[U] Formats:Controlling how data are displayed. Avalue label(possibly). This is the mechanism that allows stata to store numerical data whiledisplaying text. See[GSW] 9 Labeling dataand[U] Value labels. Avariable label, which is what you call the variable when communicating with other uses the variable label when making tables, as we will dataset is far more than simply the data it contains. It is also information that makes the datausable by someone other than the original describing the data tells us something about the structure of the data, it says little aboutthe data themselves. The data can be summarized by clicking onStatistics > Summaries, tables,and tests > Summary and descriptive statistics > Summary statisticsand clicking on theOKbutton.


Related search queries