I have my data set and need to do a count for unique analysts following a company. They are given random numbers but all I need is a final count.
So far I have this but it is not working.
Thank you for your help!
proc means data=rawdata.ibes noprint;
count=1 if analys="";
by cusip fpedats;
output out=forecastdate sum(count)=total;
There are two methods illustrated here:
/*This demonstrates how to count the number of unique occurences of a variable
across groups. It uses the SASHELP.CARS dataset which is available with any SAS installation.
The objective is to determine the number of unique car makers by origin/
Note: The SQL solution can be off if you have a large data set and these are not the only two ways to calculate distinct counts.
If you're dealing with a large data set other methods may be appropriate.*/
*Count distinct IDs;
create table distinct_sql as
select origin, count(distinct make) as n_make
group by origin;
*Double PROC FREQ;
proc freq data=sashelp.cars noprint;
table origin * make / out=origin_make;
proc freq data=origin_make noprint;
table origin / out= distinct_freq;
title 'PROC FREQ';
proc print data=distinct_freq;
title 'PROC SQL';
proc print data=distinct_sql;
Thank you. I now used a proc freq as follows.
proc freq data=sortedibes noprint order=freq;
tables CUSIP*ANALYS*FPEDATS /out=counts;
proc means data=counts max;
class CUSIP ANALYS;
How do I get the total value for unique ANALYS for a particular cusip on a particular date with is FPEDATS?
Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.
Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.