[an error occurred while processing this directive] EDS Training Manual - Introduction to Stata

EDS Training Manual - Introduction to Stata

. stata
printer friendly version Print
Page

  1. Acquaint yourself with the interface
     
    • From the training directory, http://www.columbia.edu/acis/eds/work-staff/training/stata download the all files (note you may already have spss-polljan13.dat and polljan13-codebook.pdf (they were used in SPSS exercise).
    • Find and refer to the EDS guide Stata for a PC or Mac: Brief Information. Read the sections about Help and the Stata Interface.

    •  
    • Open Stata.
      How many windows display and how many are active?
      What do each of the icons across the top represent.
      Open file n01nts.por using the file menu.
      In the review window, what command was used to open the file?
      Use the "help" menu to lookup a full description of this command (leave the help window open).
       
      To close the file, type "clear" in the command window.
      Click on the open command that is still displayed in the review menu.
      This will cause it to appear in the command window.
      Edit the line in the command window so the when executed the only variables that will be read in are: howhear, where, alone, numtel, youtel, usual (Help will explain how to do this).
      Then hit enter to open the file with just these variables.
      Click on the browse icon.
      Right click on a variable name, and in the menu that appears chose the value labels.
      This feature allows you to toggle between viewing either the actual values in the data cells or the descriptive value labels.
      The actual content of the active cell always shows in the dialog box above the table.
  2.  
  3. Working with a Stata File
     
    • If file n01nts.por is not open, open it.
      Use the codebook to find out what this survey is.
      Lookup the definitions of variables you read in.
      Lookup the the command tab.
      Before starting to analyze the relationships among the variables. Open a log file to keep of record of your results.
      How many respondents were at home or at work.
      Were they more likely to be alone if they were at home.
      Save and close the log file so that it can be opened in Excel.
      Create a new variable that equals 1 if a person was alone and phoned someone and zero is there were not alone (lookup command generate).
      How many of those alone who did phone someone, then continued with there usual acitivities?
      Close the file.

    •  
    • Now work with file courtcases.dta.
      Open it.
      There are two causes listed as potential problems in opening the file, what are they?
      Use the documentation file and the file manifest (the file manifest is always part of an ICPSR study...this is study 4382..find the manifest) to help choose what is the solution or use the describe command.
      Pick the most likely cause of the problem and use information in the warning statement and the help menu to get the answer.
      Once the file is open, type describe in the command window and press enter (once the file is in memory you don't need to specfiy the path.)
      Close the file
      Close Stata.
      Open Stata again, now read in same file but specify you only the following variables" cicuit, district, office number, docket number, defendant number, proceeding date, proceeding code, status code, and termination counsel.
      Describe the file.
      Select only those records with 5 defendants.
      How many records are left? Now select only thse records for District 10.
      How many records are left?
      Now save the file giving it another name.

     
  4. Working with ASCII Files
     
    • Now use WDI Online (World Development Indicators-new interface) to get data for use in Stata.
      Choose all latin american countires.
      Choose all interest rate variables found in the Financial Statistics menu.
      Choose year 1990 through 2003.
      Most often a regression analysis over time will require that the variables in a Stata be the series.
      Download the data with the aim to do regression in Stata. Not only do you have to think about getting the series as column headers but you must think about what ASCII format can be read by Stata, and you clean up any extra header rows.
      When you have the data in Stata, look at it with the browse option.
      Many columns will appear in red, indicating the variable is a string variable. To do a regression, the variables must be numeric. The reason there are so many non-numeric because Stata use the . (single dot) to represent missing values and WDI uses ..(double dots).
      Look at the EDS web page "File Utilities and Hints on Using Data" for a tip on what to do.
      For columns that should be numeric, convert the values to string. There are many so use the feature that you can populate the command window by clicking on anything that displays in either the review window or variable window (this save a lot of typing).
      Stata, sort it by country by year
      Since the variable Risk Premium is often missing, drop that variable.
      Drop the records for the Virgin Island
      Save this files in stata format.
      close the file
    •  
    • Do another download from WDI.
      Choose all latin american countires.
      Choose all the worker remittances series.
      Choose years 1990 through 2003.
      Save this file and import it in to Stata.
      merge the two datasets.
      how many matched and unmatched records are there.
[an error occurred while processing this directive] Friday, 06-Jul-2007 16:21:39 EDT [an error occurred while processing this directive]