Skip to content

Commit

Permalink
Update waffle.ado
Browse files Browse the repository at this point in the history
  • Loading branch information
asjadnaqvi committed Apr 4, 2024
1 parent eda4767 commit d312153
Showing 1 changed file with 42 additions and 13 deletions.
55 changes: 42 additions & 13 deletions installation/waffle.ado
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ syntax varlist(numeric min=1) [if] [in], ///
by(varname) over(varname) normvar(varname numeric) percent showpct format(string) palette(string) ///
ROWDots(real 20) COLDots(real 20) MSYMbol(string) MLWIDth(string) MSize(string) ///
NDSYMbol(string) NDSize(string) NDColor(string) /// // No Data = ND
cols(real 4) LEGPOSition(real 6) LEGCOLumns(real 4) LEGSize(string) NOLEGend margin(string) ///
aspect(numlist max=1 >0) note(passthru) subtitle(passthru) * ]
COLs(real 4) LEGPOSition(real 6) LEGCOLumns(real 4) LEGSize(string) NOLEGend margin(string) ///
aspect(numlist max=1 >0) note(passthru) title(passthru) subtitle(passthru) * ]


// check dependencies
Expand Down Expand Up @@ -52,6 +52,11 @@ quietly {

keep `varlist' `normvar' `over' `by'






local length : word count `varlist'

if `length' > 1 {
Expand All @@ -77,14 +82,30 @@ quietly {
}
if `length' == 1 {


cap ren `by' _cats
collapse (sum) `varlist' `normvar', by(_cats `over')

if "`normvar'"=="" {
collapse (sum) `varlist', by(_cats `over')
}
else {
collapse (sum) `varlist' (mean) `normvar', by(_cats `over')
}

/*
capture confirm variable `over'
if !_rc {
drop if `over'==""
}
else {
drop if `over'==.
}
*/

cap ren `varlist' y_
}



sort _cats `over'
ren y_ _val

Expand All @@ -102,12 +123,19 @@ quietly {
}
}
else {
summ `normvar' if _grp==1, meanonly
local max = r(sum)

drop `normvar'

levelsof _grp, local(lvls)

foreach x of local lvls {
summ `normvar' if _grp==`x', meanonly
if r(max) > `max' local max = r(max)
}

*drop `normvar'
}




gen double _share = .

Expand Down Expand Up @@ -218,11 +246,12 @@ quietly {

drop _i _control _temp

if "`msize'" == "" local msize 0.85
if "`msymbol'" == "" local msymbol square
if "`mlwidth'" == "" local mlwidth 0.05
if "`ndsymbol'" == "" local ndsymbol square
if "`ndsize'" == "" local ndsize 0.5
if "`msize'" == "" local msize 0.85
if "`msymbol'" == "" local msymbol square
if "`mlwidth'" == "" local mlwidth 0.05
if "`ndsymbol'" == "" local ndsymbol square
if "`ndsize'" == "" local ndsize 0.5

if "`ndcolor'" == "" {
if "`normvar'" == "" {
local ndcolor none
Expand Down

0 comments on commit d312153

Please sign in to comment.