Hello everyone,
I want to count security ID (secid) per year that has permno. I urgently needed to count them. please help me guys.
Best wishes.
my sample dataset shown as:
secid effect_date cusip ticker issuer permno
6405 1/1/1996 86590610 sugr calcomp 11727
6405 7/24/1996 12870110 clcp calcomp 11727
6406 1/1/1996 16939610 cinc china.inc 11729
6410 1/1/1996 55267210 ? mcgec.inc (none)
6409 2/11/2000 72017210 peide piedmont 75561
6420 3/7/1997 89620810 ? trimac (none)
proc sql;
select distinct year(effect_date) as year, count(distinct secid) as secid from have
where permno ne .
group by year(effect_date);
quit;
Hello everyone,
I want to count security ID (secid) per year that has permno. I urgently needed to count them. please help me guys.
Best wishes.
my sample dataset shown as:
secid effect_date cusip ticker issuer permno
6405 1/1/1996 86590610 sugr calcomp 11727
6405 7/24/1996 12870110 clcp calcomp 11727
6406 1/1/1996 16939610 cinc china.inc 11729
6410 1/1/1996 55267210 ? mcgec.inc (none)
6409 2/11/2000 72017210 peide piedmont 75561
6420 3/7/1997 89620810 ? trimac (none)
Does your PermNo variable actually contain text "(none)" or is it a SAS MISSING value? If the later
Proc freq data = have;
where not missing(permno);
tables secid;
run;
will give the count of each secid and the cumulative at the end of the table the overal count.
If the value of PermNo actually contains text of (none)
then
Proc freq data = have;
where permno ne '(none)';
tables secid;
run;
will do the same thing.
proc sql;
select distinct year(effect_date) as year, count(distinct secid) as secid from have
where permno ne .
group by year(effect_date);
quit;
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 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.