Hi!
The code itself seems alright to me, but as Andrés pointet out,it is hard to see what your problem is without knowing your data. S
If I could take a guess, however, I'd say that there are maybe no cases where the condition LFSSTAT==3 applies, is that possible?
If I run the relevant parts of youur code on some dummy data, it returns a percentage for label 1 where LFSSTAT==3 is true in one observation, and it returns 0 for label 2.
library(dplyr)
labour<-data.frame(LABEL=c(1,2,1,2,1),IMMIG=c(1,2,3,2,1),HRLYEARN=c(1,2,3,3,4),LFSSTAT=c(3,2,1,5,1))
labour
#> LABEL IMMIG HRLYEARN LFSSTAT
#> 1 1 1 1 3
#> 2 2 2 2 2
#> 3 1 3 3 1
#> 4 2 2 3 5
#> 5 1 1 4 1
labour%>%
group_by(LABEL) %>%
summarise(HRLmean=mean(HRLYEARN), HRLsd=sd(HRLYEARN),uemployed=sum(LFSSTAT=="3"), sum=sum(LFSSTAT),.groups = 'drop') %>%
mutate(unrate=uemployed/sum, percentage = unrate*100)
#> # A tibble: 2 x 7
#> LABEL HRLmean HRLsd uemployed sum unrate percentage
#> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
#> 1 1 2.67 1.53 1 5 0.2 20
#> 2 2 2.5 0.707 0 7 0 0
Created on 2020-10-25 by the reprex package (v0.3.0)
Maybe just use labour%>%filter(LFSSTAT==3) to check if there are any cases where LFSSTAT is actually 3.