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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.