Creating A Do File 2018 - Sociology

1y ago
4 Views
2 Downloads
561.25 KB
9 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Azalea Piercy
Transcription

Updated July 2018Creating a “Do” File in StataThis set of notes describes how to create a “do” file within the computer program Stata. Itassumes that you have set Stata up on your computer (see the “Getting Started with Stata”handout).A do file lists and executes Stata commands. It is a convenient and efficient alternative to typingcommands in the Stata command box. By storing commands for a particular analysis in a do file,you can easily replicate your results, re-run your analysis with modifications and elaborations, orrepeat it after correcting errors. A do file is a separate file that has a “.do” extension.“Do” files on a PC:To create a do file on a PC, click on the New Do-file Editor icon at the top of the Stata window.Alternatively, you can click on Window, then on Do-file Editor, then on New Do-file Editor.A new window will appear:

This blank text document is your do file. You can write (and edit) commands in this file as youwould in the Stata command window, in the order that you would like to execute them.For example, using the GSS2016 dataset, to obtain a frequency table for the variable “postlife”(belief in life after death) and then generate a crosstabulation of the variable “postlife” (rows)against “sex” (columns), one would type the following commands into the do file:use "S:\Data\Data sets\GSS2016.DTA"tab postlifetab postlife sex,columnThis will first load the GSS2016 dataset, then use this dataset to obtain a frequency table of“postlife” and finally generate a crosstabulation of “postlife” and “sex.” (For more information2

on these commands, please refer to the following handouts: “Reading in Stata Format DataFiles”, “Tabulations and Summary Statistics ”, and “Crosstabulations ”.)To execute all the commands in your do file sequentially in Stata, press the “Execute (do)” icon,located in the toolbar of the Do-file Editor window. Alternatively, you can click on Tools in theDo-file Editor window, then on Execute (do).If you would like to execute some but not all commands in your do file, highlight the commandsthat you want to execute and then press the “Execute (do)” icon (or click Tools ! Execute (do)).For example, if you have already loaded the GSS2016 dataset into Stata and only want to obtainthe frequency table and crosstabulation of “postlife,” highlight the following commands andpress the “Execute (do)” icon:3

You can add spaces and comments to your do files so they are easier to read and edit. Blank linesand comments in do files are not executed in Stata. To add a comment, type “*” followed by thecomment.1 Comments are automatically color-coded green in do files. Each line of text that youwant to “comment-out” needs to start with an asterisk. For example:1If you are interested in learning about other ways to include comments in a do file, see:https://www.stata.com/manuals13/u16.pdf4

To save a do file, click on File, then on Save As in the Do-file Editor. Navigate to the folderwhere you want to save your do file and enter the file name. Then click Save. (The name of thedo file above is “Analysis1.do”.) You can reload it at another time if you want to alter or extendthe analysis begun here.To open an existing do file, click on File, then on Open in the Do-file Editor. Navigate to thefolder where the do file you want to use is stored, and then click on that filename.5

“Do” files on a Mac:To create a do file on a Mac, click on File, then on New, then on Do File in the Stata window.Alternatively, you can click on the “Do-file Editor” icon in the Stata window. A new windowwill appear:This blank text document is your do file. You can write (and edit) commands in this file as youwould in the Stata command window, in the order that you would like to execute them.For example, using the GSS2016 dataset, to obtain a frequency table for the variable “postlife”(belief in life after death) and then generate a crosstabulation of the variable “postlife” (rows)against “sex” (columns), one would type the following commands into the do file:use "/Users/user1/Data/GSS2016.DTA"tab postlifetab postlife sex,columnThis will first load the GSS2016 dataset, then use this dataset to obtain a frequency table of“postlife” and finally generate a crosstabulation of “postlife” and “sex.” (For more informationon these commands, please refer to the following handouts: “Reading in Stata Format DataFiles”, “Tabulations and Summary Statistics ”, and “Crosstabulations ”.)To execute all the commands in your do file sequentially in Stata, press the “Do” button, locatedin the top-right corner of the do file window:6

If you would like to execute some but not all commands in your do file, highlight the commandsthat you want to execute and then press the “Do” button. For example, if you have alreadyloaded the GSS2016 dataset into Stata and only want to obtain the frequency table andcrosstabulation of “postlife,” highlight the following commands and press the “Do” button:7

You can add spaces and comments to your do files so they are easier to read and edit. Blank linesand comments in do files are not executed in Stata. To add a comment, type “*” followed by thecomment.2 Comments are automatically color-coded green in do files. Each line of text that youwant to “comment-out” needs to start with an asterisk. For example:2If you are interested in learning about other ways to include comments in a do file, see:https://www.stata.com/manuals13/u16.pdf8

To save a do file, click on File, then on Save As. Navigate to the folder where you want to saveyour do file and enter the file name. Then click Save. (The name of the do file above is“Analysis1.do”.) You can reload it at another time if you want to alter or extend the analysisbegun here.To open an existing do file, click on File, then on Open. Navigate to the folder where the do fileyou want to use is stored, and then click on that filename.9

You can add spaces and comments to your do files so they are easier to read and edit. Blank lines and comments in do files are not executed in Stata. To add a comment, type "*" followed by the comment.1 Comments are automatically color-coded green in do files. Each line of text that you want to "comment-out" needs to start with an asterisk.

Related Documents:

Test Name Score Report Date March 5, 2018 thru April 1, 2018 April 20, 2018 April 2, 2018 thru April 29, 2018 May 18, 2018 April 30, 2018 thru May 27, 2018 June 15, 2018 May 28, 2018 thru June 24, 2018 July 13, 2018 June 25, 2018 thru July 22, 2018 August 10, 2018 July 23, 2018 thru August 19, 2018 September 7, 2018 August 20, 2018 thru September 1

1 Creating a Board File from a Schematic File in Eagle 7.3.0 (for fabrication in the Michigan State ECE shop) Written by: Alex Sklar Keywords: Eagle, Michigan State ECE Shop, Board file, Bass Boost Headphone Amp Executive summary: The content contained in the following application note demonstrates the process of creating a Printed circuit board from a schematic file in Eagle.

Year Make Model----- ----- -----2018 Acura ILX 2018 Acura TLX 2018 Acura RLX HYBRID 2018 Alfa Romeo 4C 2018 Alfa Romeo Giulia 2018 Alfa Romeo Giulia 2018 Alfa Romeo Giulia 2018 Alfa Romeo Giulia 2018 Audi TT Roadster quattro 2018 Audi A3 2018 Audi A3 Cabriolet 2018 Audi A3 Cabriolet quattro 2018 Audi A3 quattro

IV. Consumer Price Index Numbers (General) for Industrial Workers ( Base 2001 100 ) Year 2018 State Sr. No. Centre Jan., 2018 Feb., 2018 Mar., 2018 Apr 2018 May 2018 June 2018 July 2018 Aug 2018 Sep 2018 Oct 2018 Nov 2018 Dec 2018 TEZPUR

A file pointer must be declared and used to access a file. Declaring a file pointer would be in this general form: FILE * ptr_name for example: FILE * inFile; // for an input file FILE * outFile; // for an output file inFile and outFile are just variable names, and as you know, you can name your variables whatever you want.

SAVE 100 ON OUR FULL SEO PACKAGE (NORMALLY 975) Our SEO Package includes the following items: Creating Your Google My Business Page Creating Your Google Maps Listing Creating Your Bing Listing Creating Your Apple Maps Listing Creating Your Facebook Business Page Creating Your Infogroup Listing Creating Your Acxiom Listing Updating Your Homepage Copy

akuntansi musyarakah (sak no 106) Ayat tentang Musyarakah (Q.S. 39; 29) لًََّز ãَ åِاَ óِ îَخظَْ ó Þَْ ë Þٍجُزَِ ß ا äًَّ àَط لًَّجُرَ íَ åَ îظُِ Ûاَش

Collectively make tawbah to Allāh S so that you may acquire falāḥ [of this world and the Hereafter]. (24:31) The one who repents also becomes the beloved of Allāh S, Âَْ Èِﺑاﻮَّﺘﻟاَّﺐُّ ßُِ çﻪَّٰﻠﻟانَّاِ Verily, Allāh S loves those who are most repenting. (2:22