Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

Stata Homework 1

Stata Homework 1

Stata Homework 1
Homework #1: Due Wed, May 28, 5 PM (date is subject to change)
PubH 6310, Summer 2020
Instructions
1) Download the following files from Blackboard (see the “Assignments” section) and save them on your flash drive before starting this assignment: a. health.dta b. insurance.xls c. health data extract codebook.pdf 2) For all questions, put your commands in a single do-file. You could: a. Work interactively by typing commands in the command window or using the menus (menus should be a last resort), then copy all of your successful commands to the do-file (screen out the bad commands with _rc); or b. Begin your session with a cmdlog which will save all of your commands into a separate file (see the handout from the first class for the proper syntax); or c. Type your commands in the do-file editor and run the do-file to execute the commands. Please exclude/delete any commands that result in errors. The commands in the do-file should follow the order of the questions (i.e., the commands for #1 should precede the commands for #2). Make sure you include a LOG command at the beginning of your do-file, and a header (comment) with your name at a minimum. 3) When you have finished all of the questions, run your do-file to produce the log file. Open your log file in Word and type the answers for questions #1, 2, 3, 4, 10, and 11 directly on to your log. To improve readability, change the font of the entire document to Courier New or SAS Monotype in size 8. Please make sure your name is included at the top of your document. Save this file as a Word document. 4) It is important to learn good programming practices right from the start. We will give additional credit on homework throughout the semester if you remember to (a) create variable and value labels for new or recoded variables (when not explicitly instructed to do so) and if you (b) add comments (using asterisks) to explain to readers (including you!) what you are doing. You do not need to comment every command, but at least remember to say which question you are answering. These practices make it easier to understand your programs and output. 5) Submit a copy of your Word document (consisting of the log file plus answers to questions) via Blackboard by 5 PM Thursday May 28. This date is subject to change. Questions (total points for each question appear in parentheses; totals include all subparts)
1) Open the health.dta data set in Stata. (1 point) a. How many observations are included in the data set? b. What is the source of the data included in this file? 2) Use the browse command to view the data set contents. What is the gender and age of the person whose seqn (ID number) is 77700? (Then you can close the browse window.) (0.25 points) 3) Use the codebook command to review the variables rethnic, ageyr, and health. (1.5 points) a. Is rethnic a numeric or string (text) variable? b. What are the possible values of rethnic? What do those values represent? c. What are the mean and minimum values of ageyr (age at screening, in years)? d. How many cases of health are missing? 4) Use the output from codebook and the PDF data documentation to answer the following questions about the variable faminc: (1.25 point) a. Do we know the income level for every respondent? NOTE: Answering “yes” or “no” is not sufficient. Please support your answer. b. What is the highest family income range reported in the sample? c. How many respondents have family income in the $55,000 to $64,999 range? 5) We want to merge data in this file with information about insurance status in another file. The Excel file insurance.xls contains insurance information for the population in the health data set. Use the import excel command to read it in. (Hint: use the syntax import excel using [filename], firstrow clear. The option firstrow lets Stata know that the first row in the Excel file is variable names, while the other rows are the data]. NOTE: There are variable labels included in the Excel file. You also need to clear the health data from memory or the import won’t work. (1 point) 6) Add descriptive labels to the variables you imported in question 5. Use the variable labels shown in the file PDF data documentation included with this assignment. (1 point) 7) Please add value labels to the anyunins and instatus variables you imported in question 5. (1.5 points) a. Define labels for anyunins and instatus. See the pdf documentation for values. You will not be able to use “yesno” as the label name for this set of value labels, as that name already exists in the dataset. b. Assign the newly defined value labels to the instatus and anyunins variables. Using codebook or tab, check that they worked right. c. Now recode the values of 7 and 9 for those variables to . to make sure that they are treated as missing data. 8) Save the current data set using the file name insure.dta. (0.5 point) 9) Merge the health.dta and insure.dta data sets using the key variable seqn, which is unique for all persons in both data sets. (1.5 point) 10) You plan to conduct an analysis where you need a dummy variable that identifies people who are single, where being single is defined as having a family size of 1. Please create a new variable called single with a value of 1 when famsize is equal to 1, and 0 for all other values of famsize. If any responses are missing, you should leave them as missing values in the new variable. (1.5 point) a. How many respondents are NOT single by this definition? 11) For your planned analysis, you also need an indicator variable that identifies people with good health. Use the recode command to change the values of health such that the values for people with “Excellent,” “Very Good,” and “Good” health are changed to 0 (healthy), the values for people with “Fair” or “Poor” health are changed to 1 (unhealthy). If any responses are missing, you should leave them as missing values in the new variable. Do not overwrite the existing health variable! Save the changed values in a new variable called hstatus. (1.5 point) a. How many respondents are healthy? 12) Save the final dataset with all the changes as healthfinal.dta. (0.5 point) 2

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Homework Discussion only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Homework Discussion are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Homework Discussion is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Homework Discussion, we have put in place a team of experts who answer to all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.