Sub-sample of the dataset

Solved
Occasional Contributor
Posts: 5

Sub-sample of the dataset

HI THERE,

I AM TRYING TO EXTRACT A SAMPLE OF FIRMS (WITH THE SAME PERMNO) THAT EXIST FROM FYEAR FROM 2001 TO 2011 AND DELETE THE FIRMS  THAT HAS   MISSING FYEAR AT THE BEGINNING (2001) OR AT THE END (2011) OR IN BETWEEN.

THNAK yOU FOR THE SUPPORT.

P

Accepted Solutions
Solution
‎03-28-2013 08:22 AM
Super Contributor
Posts: 543

Re: Sub-sample of the dataset

Could you explain this a bit more:

"THAT HAS   MISSING FYEAR AT THE BEGINNING (2001) OR AT THE END (2011)"

FYEAR takes values 2001 to 2011. If it's missing....How does one know that is 2001 missing? and not 2002??

Could you provide a small sample data?

All Replies
Solution
‎03-28-2013 08:22 AM
Super Contributor
Posts: 543

Re: Sub-sample of the dataset

Could you explain this a bit more:

"THAT HAS   MISSING FYEAR AT THE BEGINNING (2001) OR AT THE END (2011)"

FYEAR takes values 2001 to 2011. If it's missing....How does one know that is 2001 missing? and not 2002??

Could you provide a small sample data?

Super Contributor
Posts: 644

Re: Sub-sample of the dataset

I think this is the answer:  count the number of records with years between 2001 and 2011, and only keep those where the result is 11

Proc SQL ;

Crate table want as

Select id

From

(Select id

,      count (distinct FYear) as count

From     have (where = (FYear between 2001 and 2011))

)

Where     count = 11

;

Quit ;

(Untested code)

Richard

Occasional Contributor
Posts: 5

Re: Sub-sample of the dataset

Dear anca tilea,

I have attached the sample dataset.

The dataset is a sub-sample data that only include low growth firms. However there are firms  which are not consistenly falling  within the low growth category  from 2001 to 2011 and have missing  data in the dataset for few years.As firms can also be facing high growth between 2001 and 2010. I need to select firms which are consistently low growth between  from 2001 and 2011 from this sample data.

Thank You.

regds

p

🔒 This topic is solved and locked.