/*********************************** ************************************ ***INTRODUCTION (chapter 1) ************************************ ************************************ ************************************ ***GENERAL SOCIAL SURVEY (GSS) DATA ************************************ If you copy the GSS data to your computer before coming to class, it will make everything easier. Get the GSS resources for this course in this link: http://www.ernestoamaral.com/docs/soci420-18spring/course.zip Uncompress the file in your computer. This procedure varies across computers. Basically, it will create a folder called "course" with two sub-folders ("data" and "docs"). Save the "course" folder in a specific location in your computer, following these suggestions for Windows and Macintosh ************************************ ***WINDOWS ************************************ Save the uncompressed "course" folder under the C:\ drive. You can see the C:\ drive under "Computer" or "My PC" in Windows Explorer. ************************************ ***MACINTOSH ************************************ Save the uncompressed "course" folder under Macintosh HD (Hard Drive) To show Macintosh HD on your Finder sidebar, open Finder, click on "Finder" menu, click on "Preferences...", click on the "Sidebar" tab, and select "Hard disks" ************************************ ***CREATE SUB-FOLDERS ************************************ You should create two other sub-folders under "course" ("progs" and "output"). Some computers might ask for your password to save files in the C:\ drive or Macintosh HD. You might have to: 1) create an empty folder "course" 2) copy the "data" and "docs" folders to this new folder These steps will vary from each computer. If you have any questions, we will solve in class, but it would help if you try these steps before coming to class. ************************************ ***"COURSE" SUB-FOLDERS ************************************ "data": General Social Survey microdata "docs": codebook, information on income variable, questionnaires "progs": you should create this folder to save Stata do-files and log-files "output": you should create this folder to save tables and figures */ ************************************ ***CLEAR MEMORY ************************************ clear all ************************************ ***WINDOWS ************************************ ***Start saving results window log using "C:\course\progs\Stata01.log", replace text ***Shortcut for folders global data = "C:\course\data" global output = "C:\course\output" ************************************ ***MACINTOSH ************************************ ***Start saving results window log using "/course/progs/Stata01.log", replace text ***Shortcut for folders global data = "/course/data" global output = "/course/output" ************************************ ***OPENING COMMANDS ************************************ ***Tell Stata to not pause for "more" messages set more off ***Change directory cd "$data" ***Open 2016 GSS use "GSS2016.dta", clear ************************************ ***SAMPLE SIZE ************************************ count ***Year tabulate year tab year, missing tab year, m /* ************************************ ***RELATIONAL OPERATORS ************************************ The relational operators are: > (greater than) < (less than) >= (greater than or equal) <= (less than or equal) == (equal) != (not equal) Observe that the relational operator for equality is a pair of equal signs. This convention distinguishes relational equality from the first equality to generate a variable. See example below... */ ************************************ ***SEX ************************************ tab sex tab sex, m ***Generate dummy variable for female tab sex, nolabel generate female=. replace female=0 if sex==1 replace female=1 if sex==2 tab sex female, m tab female tab female, m ************************************ ***RELIGIOUS PREFERENCE ************************************ tab relig tab relig, m ************************************ ***RACE/ETHNICITY ************************************ ***Race tab race tab race, m ***Hispanic tab hispanic, m tab hispanic, m nolabel ************************************ ***AGE ************************************ ***Age distribution tab age tab age, m tab age, m nolabel ************************************ ***INCOME ************************************ ***Family income distribution tab income tab income, nolabel ***Respondent income distribution tab rincome tab rincome, nolabel ***Respondent income in constant dollars ***Inflation-adjusted personal income summarize conrinc summarize conrinc, detail sum conrinc, d ************************************ ***CLOSING COMMANDS ************************************ ***Save data save "Stata01.dta", replace ***Save log log close