I am trying to calculate age count.. please let me know if the below command is correct..
bys ScheduleNo: egen Age_0_14 = count(B2Q1) if Age<=14
bys ScheduleNo: egen count_Age_0_14= max(Age_0_14)
bys ScheduleNo: egen Age_15_24 = count(B2Q1) if Age>=15 & Age<=24
bys ScheduleNo: egen count_Age_15_24= max(Age_15_24)
bys ScheduleNo: egen Age_25_34 = count(B2Q1) if Age>=25 & Age<=34
bys ScheduleNo: egen count_Age_25_34= max(Age_25_34)
bys ScheduleNo: egen Age_35_44 = count((B2Q1)) if Age>=35 & Age<=44
bys ScheduleNo: egen count_Age_35_44= max(Age_35_44)
bys ScheduleNo: egen Age_45_59 = count(B2Q1) if Age>=45& Age<=59
bys ScheduleNo: egen count_Age_45_59= max(Age_45_59)
bys ScheduleNo: egen Age_60_120 = count(B2Q1) if Age>=60& Age<=120
bys ScheduleNo: egen count_Age_60_120= max(Age_60_120)
recode count_* (.= 0)
Related Posts with how to calculate age count..
Panel regression model / Multiple regression model?Hi everyone, I have a dataset available which links the the Covid-19 situation to the change in por…
Replace odd commas by spaces in a variableHi, Thanks in advance for your help. Maybe, what I am going to ask is an easy question for many of y…
why I need to run the command keep twice to delete some observations? Code: ---------------------------------------------------------------------------------------------…
Omitted interaction terms in the fixed effect due to collinearityHi all, I have a question when I am running a fixed effect regression which is used to investigate …
Regressing a variable recorded in 2018 on a variable of 2011Hello everybody, I'm a beginner of Stata and I'm already facing the first issues. I have a panel dat…
Subscribe to:
Post Comments (Atom)
0 Response to how to calculate age count..
Post a Comment