@PaigeMiller's code does provide that variable in the output unless I'm missing something.
data have;
infile datalines dlm = ',' dsd;
input company :$50. year nic;
datalines;
20 Microns Ltd.,2011,8
Ashapura Minechem Ltd.,2011,8
A D F Foods Ltd.,2011,10
Adani Wilmar Ltd.,2011,10
Agro Tech Foods Ltd.,2011,10
Ajanta Soya Ltd.,2011,10
Ambar Protein Inds. Ltd.,2011,10
Andrew Yule & Co. Ltd.,2011,10
Arcuttipore Tea Co. Ltd.,2011,10
Associated Alcohols & Breweries Ltd.,2011,11
Devyani International Ltd.,2011,11
Eco Friendly Food Processing Park Ltd.,2011,11
Elegant Floriculture & Agrotech (India) Ltd.,2011,11
Flex Foods Ltd.,2011,11
Freshtrop Fruits Ltd.,2011,12
Sree Jayalakshmi Autospin Ltd.,2011,12
A I Champdany Inds. Ltd.,2011,13
A K Spintex Ltd.,2011,13
A P M Industries Ltd.,2011,13
Aarvee Denims & Exports Ltd.,2011,13
Aditya Spinners Ltd.,2011,13
Alka India Ltd.,2011,13
Alok Industries Ltd.,2011,13
Alps Industries Ltd.,2011,13
;
run;
proc freq data=have;
tables nic/noprint out=nic_frequency;
run;
data want;
merge have nic_frequency(keep=nic count);
by nic;
run;
It's just named `COUNT` which is an automatic variable from `PROC FREQ`. You can rename it on the `MERGE` statement.
Please mark Paige's response as the correct one.
... View more