Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re:Histogram Axis labels


From   Michael Stewart <[email protected]>
To   statalist <[email protected]>
Subject   st: Re:Histogram Axis labels
Date   Sun, 9 Jun 2013 23:37:01 -0400

Dear Statalist users ,

I am trying to draw histograms for my variables and  due to large
number of  variables, am using foreach command along grss (exploratory
data analysis). I have run into problem with x axis labels in
histograms and n  was trying to see if anyone has
suggestions/recommendations

My code is as follows

foreach x of varlist *{
preserve
keep  PAT_ID  `x'
duplicates drop
count
sum `x' ,d
tabulate `x'
tabulate `x', sort
tabulate `x', plot sort
grss quantile `x'
grss hist  `x',discrete percent addlabel gap(20)  xlabel(, valuelabel)
restore
}

Problem-1: As different variables have different ranges, how can I get
Stata to show value  for every bar on x axis

Eg: If I am  drawing histogram for years 2001-2007 and I have
observations for every year,stata will show bars corresponding to each
year (with percent value on top of it) ,  but will not show the
corresponding year on x axis ... it might show  2001, 2003, 2005 2007
on x axis but not 2001 2002 2003  2004 2005 2006 2007(corresponding to
the bar)  .

Its easy to do it individually(by adjusting the number of ticks) but
in foreach loop with number of variables, with varying ranges( Eg :
years(range: 2001 - 2010), visits_per_year(range: 1 - 20) etc ) , how
can I program stata to adjust the number of ticks and yet show all
values on the x asis


--
Thank you ,
Yours Sincerely,
Mike.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index