Dear Stata community,

I have some data for which I want to calculate intraclass correlation coefficient ICC based on a one-way random model and generate median Dice score / IQR.

The data is as follows at the moment: there are 2 readers (var Reader) and 30 subjects (PatID), each has 44 measurements (only the first four are added in the sample data) and each measurement is done in a 2D and a 3D measurement (indicated by TypeOfROI).
My goal is to get dice scores for all 44 variables one time for all 2D and one time for all 3D measurements.
Can anyone point me into the right direction on how to reorder my table and achieve that?

Thanks a lot!
Michael



Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte Reader float PatID long TypeOfROI double(CONVENTIONAL_min CONVENTIONAL_mean CONVENTIONAL_std CONVENTIONAL_max)
1  1 1   138.663818359375 208.75759204005243  15.21581359301083 254.4791107177734
2  1 1   1440186309814450   1802127586408500  11826675131702300 2.19088562012e+16
1  1 2 177.04019165039063 221.61525464401532  9.520161920972896 258.2119445800781
2  1 2  15580929565429600  18506312218924000    671003870896386 2.20501083374e+16
1  2 1  97.92677307128906 148.62244394991004 13.472957833727492 189.2238311767578
2  2 1   8507294464111320   1461206664507110  15831914387136100  1.8957208252e+16
1  2 2 126.99691772460938 158.26862601154366  6.483716996590969 182.9798126220703
2  2 2  12786095428466700   1588055460144230   6173542957315020 1.83962783813e+16
1  3 1 127.97589111328125 179.21979288837963 11.884106009306763 225.7505645751953
2  3 1  12701354217529200  18003350897259600    133678127317673       23147265625
1  3 2 156.11233520507813 185.40303610660226 7.8841696553961995 213.7075500488281
2  3 2  15510955810546800  18556054729458000    771335833481087 2.13483062744e+16
1  4 1     94.96728515625  162.1609369153772  33.80949432304169 260.9996948242188
2  4 1   8963459777832030   1624470297442640   3420998098996630  2606408996582030
1  4 2 121.65918731689453 193.72317668911887 19.415705035199537 258.2693176269531
2  4 2  12121467590332000   1927981489292760   1944238202944590  2536634521484370
1  5 1 101.17062377929688 175.26513329592868  18.71673472568604 248.6464538574219
2  5 1  11824162292480400   1764549082729680   1955704618383290  2554686737060540
1  5 2  161.6698760986328 208.09321463901813  11.88224178313349 245.7072448730469
2  5 2  14966102600097600  20330023036405400  13955751484195900 2.44903594971e+16
1  6 1 106.04117584228516 159.84620943087435  20.65712807561179 266.3144836425781
2  6 1   1012131576538080  16088570028713600  21555104690411700  2533958740234370
1  6 2 135.63572692871094 172.65975425376945   10.4203848645049 219.7793121337891
2  6 2  13432785034179600  17475971692355200   1111624499112460 2.38733016968e+16
1  7 1 166.25901794433594 216.52487696629893  17.96075185517629 269.4631958007813
2  7 1  11160050201416000  21669229961949800  18633308785323200  2694119567871090
1  7 2 193.04971313476563 236.25539882421216  8.417819573745403 264.1669616699219
2  7 2    188673583984375   2336803407500060   8728779415893210  2629209899902340
1  8 1  79.59927368164063 180.39476290452126  19.72755758692028    286.4169921875
2  8 1  11243191528320300   1818130853155010  19717160441234400  2589398193359370
1  8 2 102.36597442626953 181.03043617818076  9.935269651962141 209.5366058349609
2  8 2     11622412109375  18045588436701100   8729018543835850  2085272216796870
1  9 1  85.02947998046875 143.47366171970125 16.665211865871463 193.5338439941406
2  9 1   9306468200683590   1438357915141860  16442674355800700 1.91003234863e+16
1  9 2 119.60509490966797 154.17026222856128  6.999246444354556 183.1102447509766
2  9 2  12689665985107400  15162141852023900   6998965728293880  1793996124267570
1 10 1  100.5633544921875 179.02023464770124 21.275523867157414 230.7464447021484
2 10 1  10913104248046800  18112238199818700  19823003717856400 2.34162445068e+16
1 10 2 157.95635986328125 197.70472439913527  8.799691296482338 230.4149322509766
2 10 2   1622338104248040  19603474615852800    891600724508272 2.28954681396e+16
1 11 1  124.3568115234375 173.22978560089578 18.875671874831905 237.3001861572266
2 11 1  12439228820800700  17505801356265400   1884881547556140 2.49801330566e+16
1 11 2    160.75244140625 189.26032915281004  7.361992280160571 226.2418060302734
2 11 2  15042977905273400  18806672976774200   9220303713270160 2.23801208496e+16
1 12 1  87.88247680664063 128.44491109064828 17.760656986053505 183.6774139404297
2 12 1   9151255798339840  12796202634268000  16542395676987300       18548046875
1 12 2 111.09554290771484 147.63397518806036 10.578789778079333 214.7633514404297
2 12 2  11126514434814400  14769341357396600    118330081600856               214
1 13 1  49.87210464477539  157.0476848228083  17.31010066837095 211.5357818603516
2 13 1  10258024597167900  19773552469324900  14849549021092500               268
1 13 2  78.53839874267578 166.17772789164115  8.129775716900056 197.1853942871094
2 13 2   1589105224609370  20441902434315500  11083695587339000  2529476776123040
1 14 1 122.94119262695313 179.54340116462873  22.89883937596341 243.3945159912109
2 14 1  12662627410888600  17984643851122600   2301501334339230   243266357421875
1 14 2  155.1771697998047 200.08447785194295 11.849200209096153 246.5032501220703
2 14 2   1404976043701170  19535602550002800  11890284903630300 2.46693206787e+16
1 15 1 103.67793273925781 205.79141073309899  29.58498310521202 279.6103210449219
2 15 1  12772374725341700  21660171018398600  22893557998456400 2.82036193848e+16
1 15 2 148.91233825683594 233.81946222414325 12.999911493351739 286.2328186035156
2 15 2  16649400329589800  23022332952555500  13251935325882000               281
1 16 1  60.81798553466797  205.6769219975235  26.17829982741484 285.4907531738281
2 16 1  11003507995605400  20908641752774400   2287753480121750  2930313415527340
1 16 2 101.15387725830078  200.5287373744971 15.849306397347496 259.5939636230469
2 16 2   1071539306640620  20002375698434300  14464540163988300 2.40752578735e+16
1 17 1  99.00067138671875 177.27338767953074  21.94686724832413 241.6312713623047
2 17 1  10108818817138600  17876254080801400  22746231740791200  2558390350341790
1 17 2 122.36683654785156 174.69932082225387 13.804294451732398 218.4051361083984
2 17 2  13764146423339800  20802600306816800  13214451309984600 2.48277313232e+16
1 18 1 105.77421569824219 185.68219965303982  17.48722698893326 250.1631774902344
2 18 1  14503785705566400  18700470745613600  20374777197673100 2.54714096069e+16
1 18 2  155.7902069091797 204.19488973046782  9.080370814632316 238.7701263427734
2 18 2      1723681640625   2063448246391470   8453701833695530 2.35026504517e+16
1 19 1 127.03812408447266 199.40410691315577 20.906162025963894 279.6932678222656
2 19 1  14251951599121000  19669661663204800  22571350892722600  2536189727783200
1 19 2 172.62254333496094  221.5619375323722  10.96280510708815 255.4777221679688
2 19 2  15071009826660100  19402877998098000  13701155320500400 2.39715637207e+16
1 20 1  67.35123443603516  220.6102333612553  25.81472469992596 293.4282836914063
2 20 1   1604271240234370  20525065027545800  14373690076447500 2.78551330566e+16
1 20 2 150.46470642089844 246.63432166745534 16.760385870051532 300.1070861816406
2 20 2   1506055450439450   2471737284425830   1667418510000340  3007252197265620
1 21 1 140.51112365722656   230.949157688239  19.85566894696978 288.1470642089844
2 21 1  14256930541992100  24857126404493900   1351013530207010 3.06006408691e+16
1 21 2 142.46461486816406  244.6006256113521 13.605742947395555   285.62158203125
2 21 2  15813339233398400  25035133011032800  11087199908605300  2868002014160150
1 22 1  142.2339630126953 200.99682207906048 15.496519029045086 268.1202697753906
2 22 1  12319722747802700   2065139078607250  18538707638629000  2684980773925780
1 22 2 123.20846557617188 225.32694989637196 13.718517328647287 269.3253173828125
2 22 2  17375721740722600   2229532619356540  12309005980132400 2.67295837402e+16
1 23 1  88.33360290527344 138.66715645833315 14.006167807037984  181.267822265625
2 23 1   9316423034667960   1448592571870860   9130088730457770 1.81650405884e+16
1 23 2 108.48023986816406 146.31909422377998  8.062511597339167   176.04541015625
2 23 2  10714337158203100  14662125628148200   7698056695439250 1.71444198608e+16
1 24 1  80.34847259521484 150.84438991723084  14.79395666454875 204.2356414794922
2 24 1   9273384094238280  14674572367972400  1.32008629095e+16 1.87693695068e+16
1 24 2 126.24437713623047  160.3845311901917 10.436706320964221 205.4947357177734
2 24 2   1243948745727530  15969710649336900   9961277391061860 1.98817443848e+16
1 25 1  55.63329315185547  198.4275643797045 36.729161588599176 267.7587280273438
2 25 1  16452586364746000   2272472668686470  11309374979819200  2670058288574210
1 25 2  117.6885757446289 229.30659137719766 19.653864400774435 280.7114562988281
2 25 2  10957727813720700  21241167766167600   1626794999479960  2657784118652340
end
label values TypeOfROI TypeOfROINew
label def TypeOfROINew 1 "2D", modify
label def TypeOfROINew 2 "3D", modify