Hello Statalist,

I'm working with an integer variable "ind" (for industry) and a 0-1 binary float variable "skill_type1"

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int ind
9890
 180
7780
9480
6990
7870
9890
7860
7390
8680
7270
1990
9590
4690
7860
7860
1190
9590
9590
8590
 770
9370
8680
9590
8180
6570
8190
 770
9590
8590
9570
9590
8370
 770
9590
9160
6170
4690
8660
9470
7380
2370
8370
2870
4470
3580
9590
9590
8560
4690
8470
 670
 770
9590
8170
9590
1270
9370
 170
7860
9470
7070
8170
6290
 770
6970
9590
8570
9470
8680
4970
2790
9470
9380
8680
6170
9370
8170
9590
7580
7280
7460
7870
7070
8590
9590
9590
3390
8190
4770
7080
2980
8190
9380
 380
4780
 470
9470
9590
8090
end
Code:
. codebook skill_type1

----------------------------------------------------------------------------------------------------------
skill_type1                                                                                    (unlabeled)
----------------------------------------------------------------------------------------------------------

                  type:  numeric (float)
                 label:  skill_type1

                 range:  [0,1]                        units:  1
         unique values:  2                        missing .:  0/90,026

            tabulation:  Freq.   Numeric  Label
                        70,571         0  no industry change
                        19,455         1  industry change
I'm trying to generate a new variable that stores the proportion of industry changes (i.e. skill_type1 at value 1) per industry. For example, for the industry value "170" below, I would like the new variable to store the value equivalent of "189/803".

Code:
. tab ind skill_type1

           |      skill_type1
  industry | no indust  industry  |     Total
-----------+----------------------+----------
       170 |       614        189 |       803 
       180 |       565        171 |       736 
       190 |        48         11 |        59
I'd appreciate your suggestions for how I should proceed.