Skip to content

Commit 5b47f93

Browse files
committed
Added option to allow user to specify transformation of variable before using it as a weight variable for bubble plots and updated/improved helpfile navigation.
1 parent 5f67920 commit 5b47f93

File tree

3 files changed

+329
-40
lines changed

3 files changed

+329
-40
lines changed

eda.ado

Lines changed: 79 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
* the LaTeX source document. *
88
* *
99
* Lines - *
10-
* 691 *
10+
* 755 *
1111
* *
1212
********************************************************************************
1313

1414
*! eda
1515
*! v 0.0.0
16-
*! 29OCT2015
16+
*! 30OCT2015
1717

1818
// If you don't have the tuples program installed you may want to do that
1919
// ssc inst tuples, replace
@@ -39,7 +39,8 @@ prog def eda
3939
QFIT2(string asis) LOWess LOWess2(string asis) FPFIT FPFIT2(string asis) ///
4040
LFITCi LFITCi2(string asis) QFITCi QFITCi2(string asis) FPFITCi ///
4141
FPFITCi2(string asis) noBUBBLEplots noBOXplots noMOSAIC noHEATmap ///
42-
COMPile PDFLatex(passthru) SLOw BYGraphs(string asis) BYVars(varlist) ]
42+
COMPile PDFLatex(passthru) BYGraphs(string asis) BYVars(varlist) ///
43+
WEIGHTtype(passthru) ]
4344

4445
// Make the sample to use for the program
4546
marksample edause, strok novarlist
@@ -244,8 +245,6 @@ prog def eda
244245
file write doc "\newpage\clearpage \tableofcontents \newpage\clearpage" _n
245246
file write doc "\listoffigures \newpage\clearpage" _n
246247
file write doc "\listoftables \newpage\clearpage" _n
247-
file write doc "\chapter{Graphs} \newpage\clearpage" _n
248-
file write doc "\begin{landscape}" _n
249248

250249
// Make sure the data are stored more efficiently
251250
qui: compress
@@ -265,11 +264,58 @@ prog def eda
265264
misstable pattern
266265
*/
267266

268-
// Add entry for univariate distributions
269-
file write doc "\section{Univariate Distributions} \newpage\clearpage" _n
267+
// Check for univariate graphs
268+
if inlist("", "`bargraphs'", "`piecharts'", "`histograms'", ///
269+
"`distroplots'", "`ladderplots'") == 1 {
270+
271+
// Add univariate to macro
272+
loc graphs "univariate"
273+
274+
} // End IF Block for univariate graphs
275+
276+
// Check for bivariate graphs
277+
if inlist("", "`scatterplots'", "`bubbleplots'", "`boxplots'", ///
278+
"`mosaic'", "`heatmap'") == 1 {
279+
280+
// Add bivariate to graphs macro
281+
loc graphs `graphs' "bivariate"
282+
283+
} // End IF Block to check for graphs
284+
285+
// If any graphs are going to be drawn
286+
if `"`graphs'"' != "" {
287+
288+
// Add a graphs chapter header and set
289+
file write doc "\chapter{Graphs} \newpage\clearpage" _n
290+
291+
// Check for univariate graphs
292+
if inlist("univariate", "`: word 1 of `graphs''") == 1 {
293+
294+
// Add entry for univariate distributions
295+
file write doc "\section{Single Variable Graphs} \newpage\clearpage" _n
296+
297+
} // End IF Block for univariate graphs
298+
299+
// Check for only bivariate graphs
300+
else if "`graphs'" == "bivariate" {
301+
302+
// Add entry for univariate distributions
303+
file write doc "\section{Multi-Variable Graphs} \newpage\clearpage" _n
304+
305+
} // End ELSE IF Block for multivariable graphs only
270306

271-
// Add subsubsection header for categorical data
272-
file write doc "\subsection{Categorical Variables} \newpage\clearpage" _n
307+
// Change the page orientation to landscape
308+
file write doc "\begin{landscape}" _n
309+
310+
} // End IF Block for graphs macro
311+
312+
// If Block for categorical variable sub header
313+
if inlist("", "`bargraphs'", "`piecharts'") {
314+
315+
// Add subsubsection header for categorical data
316+
file write doc "\subsection{Categorical Variables} \newpage\clearpage" _n
317+
318+
} // End IF Block for categorical variables sub header
273319

274320
// Check if user wants bargraphs
275321
if "`bargraphs'" != "nobargraphs" & !inlist(`catvarcount', 0, .) {
@@ -289,9 +335,15 @@ prog def eda
289335

290336
} // End IF Block for pie charts option
291337

292-
// Add subheading to the LaTeX file
293-
file write doc "\subsection{Continuous Variables} \newpage\clearpage" _n
338+
339+
// If Block for continuous variable sub header
340+
if inlist("", "`histograms'", "`distroplots'", "`ladderplots'") == 1 {
341+
342+
// Add subheading to the LaTeX file
343+
file write doc "\subsection{Continuous Variables} \newpage\clearpage" _n
294344

345+
} // End IF Block for continuous variable sub header
346+
295347
// Check if user wants histograms
296348
if "`histograms'" != "nohistograms" & !inlist(`contvarcount', 0, .) {
297349

@@ -320,9 +372,15 @@ prog def eda
320372

321373
} // End IF Block for ladder of power graphs
322374

323-
// Header for bivariate/conditional distribution graphs
324-
file write doc "\section{Bivariate Distributions} \newpage\clearpage" _n
375+
376+
// If Block for bivariate graphs
377+
if "`: word 2 of `graphs''" == "bivariate" {
378+
379+
// Header for bivariate/conditional distribution graphs
380+
file write doc "\section{Multi-Variable Graphs} \newpage\clearpage" _n
325381

382+
} // End IF Block for bivariate subheader with univariate graphs
383+
326384
// Check for scatter plot option
327385
if "`scatterplots'" != "noscatterplots" & !inlist(`contvarcount', 0, .) {
328386

@@ -380,9 +438,15 @@ prog def eda
380438
} // End IF Block for correlation heatmap option
381439

382440

383-
// Change back to portrait page layout
384-
file write doc "\end{landscape}" _n
441+
442+
// If any graphs are going to be drawn
443+
if `"`graphs'"' != "" {
444+
445+
// Change back to portrait page layout
446+
file write doc "\end{landscape}" _n
385447

448+
} // End IF Block to reorient pages after graphs section
449+
386450
// Create next section/subsection headers
387451
file write doc "\chapter{Descriptive Statistics} \newpage\clearpage" _n
388452

0 commit comments

Comments
 (0)