BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pras3
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
AncaTilea
Pyrite | Level 9

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?

View solution in original post

3 REPLIES 3
AncaTilea
Pyrite | Level 9

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?

RichardinOz
Quartz | Level 8

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

pras3
Calcite | Level 5

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 625 views
  • 3 likes
  • 3 in conversation