Hi everyone,

I have two clubs (Kibila & GAF 2) in my dataset each having 73 and 75 observations respectively. Each observation is distinguished by a 7 digit household id (hhid) and 8 digit correspondent id (crid). The first four digits of the hhid are codes which define a club, for instance, all hhids for club Kibila start with "1610" whereas crid is simply adding 1,2,3... in front of the household id depending on how many members are in a household. For example, hhid 1610373 appear twice but the corresponding crids are 16103731 and 16103732 for the two household members.

I want to create 10 rows for each club such that:

1) Variable hhid is a 7 digit code with the first four-digit equivalent to the code of the club (which is the same for all observations that belong to the same club) and the remaining 3 digit from 900-909 (e.g. for Kibila, extra hhids will be 1610900, 1610901, 1610902 etc)

2) Variable club can simply be the name of the club for which these observations belong to.

3) Variable crid is simply hhid with number 1 in front. (e.g. for Kinila, extra crids will be 16109001, 16109011, 16109021 etc)

My actual dataset has a lot more than 2 clubs. I'm looking for a code that could systematically do this for all clubs. Any help in this regard will be highly appreciated.

Thanks.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str7 hhid str20 club str8 crid
"1610368" "Kibila" "16103681"
"1610369" "Kibila" "16103691"
"1610370" "Kibila" "16103701"
"1610372" "Kibila" "16103721"
"1610372" "Kibila" "16103722"
"1610373" "Kibila" "16103731"
"1610373" "Kibila" "16103732"
"1610375" "Kibila" "16103751"
"1610376" "Kibila" "16103761"
"1610377" "Kibila" "16103771"
"1610378" "Kibila" "16103781"
"1610379" "Kibila" "16103791"
"1610381" "Kibila" "16103811"
"1610382" "Kibila" "16103821"
"1610383" "Kibila" "16103831"
"1610385" "Kibila" "16103851"
"1610386" "Kibila" "16103861"
"1610387" "Kibila" "16103871"
"1610388" "Kibila" "16103881"
"1610389" "Kibila" "16103891"
"1610390" "Kibila" "16103901"
"1610391" "Kibila" "16103911"
"1610392" "Kibila" "16103921"
"1610393" "Kibila" "16103931"
"1610394" "Kibila" "16103941"
"1610395" "Kibila" "16103951"
"1610396" "Kibila" "16103961"
"1610397" "Kibila" "16103971"
"1610398" "Kibila" "16103981"
"1610398" "Kibila" "16103982"
"1610398" "Kibila" "16103983"
"1610399" "Kibila" "16103991"
"1610402" "Kibila" "16104021"
"1610402" "Kibila" "16104022"
"1610402" "Kibila" "16104023"
"1610403" "Kibila" "16104031"
"1610404" "Kibila" "16104041"
"1610405" "Kibila" "16104051"
"1610405" "Kibila" "16104052"
"1610406" "Kibila" "16104061"
"1610408" "Kibila" "16104081"
"1610408" "Kibila" "16104082"
"1610408" "Kibila" "16104083"
"1610409" "Kibila" "16104091"
"1610410" "Kibila" "16104101"
"1610411" "Kibila" "16104111"
"1610413" "Kibila" "16104131"
"1610414" "Kibila" "16104141"
"1610416" "Kibila" "16104161"
"1610422" "Kibila" "16104221"
"1612423" "GAF 2"  "16124231"
"1612424" "GAF 2"  "16124241"
"1612425" "GAF 2"  "16124251"
"1612426" "GAF 2"  "16124261"
"1612427" "GAF 2"  "16124271"
"1612427" "GAF 2"  "16124272"
"1612428" "GAF 2"  "16124281"
"1612429" "GAF 2"  "16124291"
"1612429" "GAF 2"  "16124292"
"1612429" "GAF 2"  "16124293"
"1612429" "GAF 2"  "16124294"
"1612430" "GAF 2"  "16124301"
"1612431" "GAF 2"  "16124311"
"1612432" "GAF 2"  "16124321"
"1612433" "GAF 2"  "16124331"
"1612434" "GAF 2"  "16124341"
"1612434" "GAF 2"  "16124342"
"1612435" "GAF 2"  "16124351"
"1612437" "GAF 2"  "16124371"
"1612438" "GAF 2"  "16124381"
"1612439" "GAF 2"  "16124391"
"1612439" "GAF 2"  "16124392"
"1612440" "GAF 2"  "16124401"
"1612441" "GAF 2"  "16124411"
"1612442" "GAF 2"  "16124421"
"1612443" "GAF 2"  "16124431"
"1612444" "GAF 2"  "16124441"
"1612445" "GAF 2"  "16124451"
"1612446" "GAF 2"  "16124461"
"1612447" "GAF 2"  "16124471"
"1612448" "GAF 2"  "16124481"
"1612449" "GAF 2"  "16124491"
"1612450" "GAF 2"  "16124501"
"1612451" "GAF 2"  "16124511"
"1612452" "GAF 2"  "16124521"
"1612452" "GAF 2"  "16124522"
"1612453" "GAF 2"  "16124531"
"1612454" "GAF 2"  "16124541"
"1612456" "GAF 2"  "16124561"
"1612457" "GAF 2"  "16124571"
"1612458" "GAF 2"  "16124581"
"1612459" "GAF 2"  "16124591"
"1612460" "GAF 2"  "16124601"
"1612461" "GAF 2"  "16124611"
"1612461" "GAF 2"  "16124612"
"1612462" "GAF 2"  "16124621"
"1612463" "GAF 2"  "16124631"
"1612463" "GAF 2"  "16124632"
"1612464" "GAF 2"  "16124641"
"1612465" "GAF 2"  "16124651"
end