Hi, All,

I have survey data with responses from individuals (n = 1077, some missing data), and those individuals are in various departments. I have a deptid to uniquely identify each department.

The responses are on a 1-5 Likert style scale, where '4' and '5' are Agree and Strongly Agree, respectively.

I am trying to think of a simple way to create a new variable that indicates the following:
Percent of Individuals who Agree or Strongly Agree within each department.
It can be:
n in department who agree or strongly agree / total n,
i.e., it does not have to be:
n in department who agree or strongly agree / n in department
Is there a quick way to do this? I have fought with bysort and egen this morning and haven't cracked it yet.

Failed attempt so far:

Code:
egen org1agree=anycount(orgfair1), v(4/5)
This gave me a 0/1 indication of whether an individual responded with a 4 or 5, but I wasn't sure where to go from there, or how to connect that with deptid

Example of data:
Code:
dataex uniqueid deptid orgfair1 orgfair2
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str12 uniqueid int deptid byte(orgfair1 orgfair2)
"1016_337_3"   3 3 3
"1010_337_3"   3 . .
"1007_337_3"   3 1 1
"1012_337_3"   3 1 1
"1009_337_3"   3 1 2
"1014_337_3"   3 1 1
"1024_468_4"   4 1 1
"1030_468_4"   4 5 5
"1352_408_26" 26 4 4
"1346_408_26" 26 2 2
"1350_408_26" 26 2 2
"1381_312_27" 27 3 3
end