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

# st: Generating industry quintiles on basis of the increase in cash flow risk

 From Martijn S To statalist@hsphsun2.harvard.edu Subject st: Generating industry quintiles on basis of the increase in cash flow risk Date Tue, 24 May 2011 18:14:44 +0200

```Hello all,

I have problems generating industry quintiles on basis of the increase
in cash flow risk.

•	It involves the following variables: fyear, industrycode,
industrycashflowrisk.
•	Fyear has a range from 1999-2010.
•	Industrycode has a range from: 1 to 99, denoting the industries in
which each firm is active.
•	Industrycashflowrisk is a variable which represents cash flow risk.

My sample obtains firm-year observations.

I want to do the following:
1.	I want per industrycode the difference between the
industrycashflowrisk in 2010 and in 2001. Thus I want 1 variable which
is filled with these differences.
2.	Next I want to develop 5 quintiles which are based on the height of
these differences. So for example, if industrycode 10 does belong to
the industries for which the industrycashflowrisk has risen the ‘most’
I want to assign to each firm, in each year, a ‘5’ when it is active
in industry 10. Each industry should only be assigned to 1 particular
quintile number. Thus, I do not want the quintile to assign a 4 to
some firms in industry 10, and a 5 to other firms in industry 10.

Other notes:
•	Some industries only have observations from 2001 till e.g. 2008. I
do not want to take these industries into account. Thus the quintile
generating process should not assign a number to observations in that
industry. I only want to assign a quintile number to industries which
have observations in 2001 and in 2010.
•	The industrycode variable has a range from 1 to 99, but some
industries do not occur, for example I have industries starting with:
1,2,7,8 (thus they have gaps in it)

I tried some by sort functions and doing manually but I cannot get the
problem solved.

I hope someone can help me solve this problem.

Thanks,

Martijn

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```