I believe this should work:
egen count = count(earn) if earn != 0 , by(id)
xtline earn if count >= 5 & !mi(count)
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Frank Spakowski
> Sent: Monday, May 29, 2006 3:51 PM
> To: [email protected]
> Subject: st: xtline only for datasets with more than x values
>
> I have panel data with the year, id and earn (among others). Now I'm
> trying to create a line graph for my variable "earn", but only for the ids
> with more than five observations. That is, if I have more than 10 zeroes
> or missing values in my time series of 15 years (for each id), I want the
> whole firm to be excluded from the graph. Does anybody know how I can
> achieve this?
>
> Many thanks!
> Frank
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/