Menu

DataAppendixScripts/

The Data Appendix Scripts contain commands that generate the figures, tables, and other descriptive statistics that are presented in the Data Appendix.

The Data Appendix script should be saved in the DataAppendixScripts/ folder.

  • How many Data Appendix Scripts should I write?

    You may choose whether you write a single Data Appendix Script with commands that generate all the output required for your Data Appendix, or break up these commands in multiple Data Appendix Scripts.

    If you have just one Analysis Data File, it is usually convenient to write just one Data Appendix Script.

    If you have multiple Analysis Data Files, it may be convenient to write multiple Data Appendix Scripts, with each Data Appendix Script producing the output for one of the Analysis Data Files.

Guidelines for the Data Appendix Scripts

When you write the Data Appendix Scripts, be sure to follow the general guidelines that apply to all scripts.

Additional guidelines that apply particularly to the Data Appendix Scripts are presented below.

The header in the Data Appendix Scripts

In addition to the information specified for the header of all the scripts you write, the header for each Data Appendix Script should remind the user that they must execute all the Processing Scripts before they execute the Data Appendix Scripts.

This is necessary because the Processing Scripts create the Analysis Data Files that are used by the Data Appendix Scripts.

Tasks your Data Appendix Scripts should accomplish

The tasks that should be accomplished by the commands in your Data Appendix Scripts fall in three categories:

● Open the Analysis Data Files

Before any commands that start generating the output you will use in the Data Appendix, you must write commands that open the Analysis Data Files.

  • Read more

    When you write a command that opens an Analysis Data File, you must specify where the file is stored, and you should do so using a relative directory path.

    Assuming that

    • You have adopted the convention of designating your Project/ folder as the working directory at all times

    and

    • The Analysis Data File is stored in the AnalysisData/ folder

    the relative directory path should begin in your Project/ folder and lead to the AnalysisData/ folder:

    >Data/AnalysisData/


● Generate the figures, tables, and other descriptive statistics that are presented in the Data Appendix

Your Data Appendix Scripts should include commands that generate all the figures, tables, and other descriptive statistics you present in the Data Appendix.

  • Read more

    Details on the figures, tables, and other descriptive statistics that should be included in the Data Appendix are providedhere.

    Before the command(s) that generate each piece of output for the Data Appendix, write a comment that indicates what output is being produced. For example:

    • The next command finds the number of missing observations for the variable age in the Analysis Data File called AnalysisIndividual.xxx.
    • The next command generates the numeric descriptive statistics for the variable age in the Analysis Data File called AnalysisIndividual.xxx.
    • The next command generates the histogram for the variable age in the Analysis Data File called AnalysisIndividual.xxx.
    • The next command generates the frequency table for the variable own_home in the Analysis Data File called AnalysisHousehold.xxx.
    • The next command generates the bar graph for the variable own_home in the Analysis Data File called AnalysisHousehold.xxx.

    where .xxx represents the file name extension assigned to data files by the software you are using. (For example, if you are using Stata, .xxx would be replaced by .dta; if you are using R, .xxx would be replaced by .rda or .Rdata; and if you are using SPSS, .xxx would be replaced by .sav.)


● Create new files that preserve the figures, tables, and other output that will be used in the Data Appendix, and save them in the DataAppendixOutput/ folder

In addition to producing the various kinds of output that you will present in the Data Appendix, your Data Appendix Scripts should include commands that create and save new files that preserve the output as it is generated.

These files are called Data Appendix Output Files.

  • Read more

    ● Depending on the software you are using, you may use a variety of commands to create and save these files, such as "save", "export", "display", "print", or many others.

    In some cases, it may be convenient to save part of your output by writing commands that open a log file just before the command that generates the output and then close the log file just after the command that generates the output. (By opening and closing a log file before and after each command that generates output for the Data Appendix, you will create a separate file for each piece of output.)

    ● Your Data Appendix Output Files may be stored in a variety of formats, partly depending on the kind of output they contain. For more information, see these examples of possible formats for Data Appendix Output files.

    ● In the commands that save the Data Appendix Output Files, you will need to specify names for the files. Follow these guidelines for naming Data Appendix 0utput Files.

    ● When you write a command that saves a Data Appendix Output File, you must specify where the file should be stored, and you should do so using a relative directory path.

    Assuming you have adopted the convention of keeping your Project/ folder set as the working directory at all times, the relative directory path should begin in your Project/ folder and lead to the DataAppendixOutput/ folder:

    >Output/DataAppendixOutput/


Do the Data Appendix Scripts Need to be Run in a Particular Order?

No. After the Processing Scripts have been run, it should be possible to run the Data Appendix Scripts in any order.

That is because the only data files the Data Appendix Scripts use are the Analysis Data Files that are created and saved by the Processing Scripts. None of the Data Appendix Scripts create any output or data files that are used by any of the other Data Appendix Scripts.

Naming the Data Appendix Script

If you have a single Data Appendix Script, give it the name DataAppendixScript.yyy.

If you have multiple Data Appendix Scripts, give them names that distinguish them in some meaningful way.

For example, suppose you have three Analysis Data Files, one with individual-level data, one with household-level data, and one with geographical data, and you write a separate Data Appendix Script to generate the necessary output for each Analysis Data File. You might then name the three Data Appendix Scripts:

  • DAS_individual.yyy, DAS_household.yyy, and DAS_geographical.yyy

where the extension .yyy represents the file name extension assigned to scripts by the software you are using. (For example: If you are using Stata, .yyy would be replaced by .do; if you are using R, .yyy would be replaced by .R; and if you are using SPSS, .yyy would be replaced by .sps.)