use awk to replace empty fields with the latest nonempty field

Hi suppose I have a csv file like this

count,1977,1978,1979
usa,         ,       , blue
japan,   red, yellow,green
india,        ,  yellow,blue
china,   blue, yellow, green

I want the output to be(replace everything, including empty data, with the most recent data):

count,1977,1978,1979
usa,     blue, blue, blue
japan,   green, green,green
india,    blue,  blue,blue
china,   green, green, green

how to do this in awk? thanks.

Try this:

awk -F, 'NR>1{for(i=2;i<NF;i++){$i=$NF}}1' OFS="," file