BookmarkSubscribeRSS Feed
IR_ANALYST_UCF
Calcite | Level 5

I have this dataset below - 

FacultyIDStudent IDTerm
1112010
1112011
1112012
1122013
1122014
1132012
1132013
1132014
1132015
2152011
2152012
2152013
2152015
2152016
2152017
2162011
2162012
2162013
2162014
3172012
3172014
3172016
3172018
3172020
3172022
3172024
4182012
4182013
4182014
4182015
4182016
4192016
4192017
4202016
4212012
4212013
4212014
4212015


I am interested in calculating the Average Terms a faculty is associated with a student. In the above example the average terms for fac id 1 is  3 for 2 it is 5, for 3 it is 7 and for 4 it is 3. 
Formula used is Sum(Count(Terms))/Count(Student ID) for every Faculty ID. 

I have other category variables associated with the student id and faculty id and hence want to calculate the item dynamically instead of aggregating the dataset prior ro bringing it into VA 7.3.  

Thanks for your responses. 

1 REPLY 1
RDHamm
Fluorite | Level 6

Hi there.  I think I have this figured out.

I used your data.  These are the steps that I took:

  1. I used each of the items as a category.
  2. I created a new custom item that concatenated the faculty ID and the student ID
    1. Fac ID - St ID = Concatenate(Format('FacultyID'n[Raw], 'BEST4.'), Format('Student ID'n[Raw], 'BEST4.'))
  3. I created 3 aggregated measures from Fac ID - St ID (you could do this with one)
    1. Count = Count [_ByGroup_] ('Fac ID - St ID'n)
    2. Distinct = Distinct [_ByGroup_] ('Fac ID - St ID'n)
    3. Avg = 'Count'n / 'Distinct'n

I was able to create the results you were looking for.

 

Cheers, Roger


result.jpg

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 839 views
  • 0 likes
  • 2 in conversation