there are five columns
id source target value flag. and flag has the following values.each value can be present more than 1 time for each id
    flag
    first
    gen16
    last
    all
how to transpose this flag field as columns first gen16 last all and then under each of these columns give their count for the respective id