# Now lets practice using the do file after youve

This preview shows pages 1–3. Sign up to view the full content.

Now let’s practice using the do-file. After you’ve written your initial comment, go down to an empty line by pressing return (you can skip a few lines if you want since Stata will simply ignore blank space). Any command that you could enter into the command bar you can also use from the do-file. For example, let’s say we want to tab the variable age. You can write the following onto the new line in your do-file: tab educ, m . Notice that after you complete this line and press return (to go down to the next line) Stata does not execute the command. Stata will not execute any commands from the do-file until you instruct it to. Let’s try running this command. Highlight the line you just wrote and click the “execute” button. It looks like this: The appropriate output should now show up in the output window. Copy and paste this output into your output window . Now let’s try summarizing the same variable. Type sum educ, d

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
onto the next line. Now highlight both lines and click the execute button. Notice that if more than one line is highlighted Stata will execute each highlighted line sequentially. If you want you can try including your initial comment in the highlighted block. Notice that Stata ignores this when it executes the lines. Copy and paste the summarize output onto the output sheet . PART 2: Understanding Scaling Let’s take some time to learn to make scales in Stata. Scaling is a method of “data reduction” that allows us to combine the measurements from distinct, yet similar variables into a single measure. Essentially, we can scale variables together into a single measure if we think they are measuring different dimensions of the same underlying construct. The simplest type of scale, which we will practice constructing in this lab is called an additive scale. It is constructed by simply adding the values of different variables together to form a new variable. To get a
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern