hi, thank you in advance for your kind attention.
i have 2 variables: COMPANYID and YEAR
COMPANYID is between 1-100. YEAR can be anywhere between 1950-2013
I want to keep the COMPANYIDs that have more than 10 years within them.
for example:
companyID 1 may have year 1950, 1951 only. i want to drop companyID 1 completely because i only see 2 years and my threshold is 10.
Can you provide me your guidance?
thank you!
Do the years need to be consecutive, or do any 10 years count?
proc sql;
create table want as
select companyid, year, count(*) as count_years
from have
group by companyid
having count(year)>10;
quit;
Do the years need to be consecutive, or do any 10 years count?
proc sql;
create table want as
select companyid, year, count(*) as count_years
from have
group by companyid
having count(year)>10;
quit;
thank you for your reply reeza.
what if i want them to fall in a specific time period? ie: 1950-1960? thank you much!
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.