Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Data Analysis with STATA

You're reading from   Data Analysis with STATA Explore the big data field and learn how to perform data analytics and predictive modelling in STATA

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher Packt
ISBN-13 9781782173175
Length 176 pages
Edition 1st Edition
Arrow right icon
Toc

Table of Contents (11) Chapters Close

Preface 1. Introduction to Stata and Data Analytics FREE CHAPTER 2. Stata Programming and Data Management 3. Data Visualization 4. Important Statistical Tests in Stata 5. Linear Regression in Stata 6. Logistic Regression in Stata 7. Survey Analysis in Stata 8. Time Series Analysis in Stata 9. Survival Analysis in Stata Index

Macros

A Stata macro is not a black box where we can input the text and numbers. You can use this module or box in various commands. One of the best tricks in Stata is to leverage many macro statements or, as they are rightly called, modules or boxes in a single Stata command and optimize the entire code.

First, let's look at local macros. If you are an experienced programmer, you might know the difference between global variables and local variables. This difference remains in Stata as well. Most of the macros in Stata are local macros and are written for specific commands or functions that can be reused for many occasions. For example, take a look at the following command:

local macro_Name table

For example:

local Y 9

In this command or macro, the name of the macro is Y and 9 is the denotation of the table. Another example can be as follows:

display "Y"

On a general note, all the macros are processed by the macro processor. The macro processor properly feeds the macros to Stata...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime