Hi, I have a dataset for 2 groups of IDs (Treated vs Placebo) for whom different outcomes were measured over three visits over a year (paired). I did the long format for the group (Treated vs Placebo) and for visits. I need to convert visits to wide so I get eac outcome as var visit1, var visit5, var Visit8
here is an example of my data
dataex PatientID ipiratioauc tpiratioauc cpepauc visit group
----------------------- copy starting from the next line -----------------------
Thanks in advance
here is an example of my data
dataex PatientID ipiratioauc tpiratioauc cpepauc visit group
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str12 PatientID double(ipiratioauc tpiratioauc cpepauc) long(visit group) "0502 " .1334045540475425 1.454032298670401 98.96875000000001 1 1 "0402" .2330269912647059 1.19606092434556 174 1 1 "1404 " . . . 1 1 "0401" . . . 1 1 "0404 " .1729400386375942 1.300252039283811 124.25 1 1 "0407" .1803098106073392 .6590712103735878 71.5 1 1 "0917" .228836347565508 1.507599271296828 123.375 1 1 "0505 " . 3.287253536477117 148.125 1 1 "1505" .4985534368736553 3.696104612019237 65 1 1 "0210" .0838132043379123 .6549116376414134 166.625 1 1 "1105 " .3409979639775547 2.379604112809234 117.25 1 1 "0101 " .1122716819553272 1.092942238238764 56.5 1 1 "1503 " .1299902401889971 1.195652399845404 141.375 1 1 "0205 " .2165484537586932 4.662687072197448 7.928750000000001 1 1 "0701 " . . . 1 1 "1301 (1003) " .1537766172195993 2.830885682861286 77.125 1 1 "0802 " .4577974003988178 4.231416530943378 108.0875 1 1 "0907 " .3840034890859194 2.19425767837188 163.5 1 1 "0103" .208616083058608 2.551412876831502 87.375 1 1 "1101 (0201) " .4280923938925788 4.881002312383851 87.5 1 1 "0208 " .115436838 1.847744052 14.00125 1 1 "0915" . . . 1 1 "0303 " .2714260464110263 1.381252819589264 167.53 1 1 "1506 (0914)" .2025895901843955 2.121623288966065 134.375 1 1 "0503 " . . . 1 1 "0802 " .2571346177876655 2.940804536625491 109.66625 2 1 "1105 " .4176234471500722 2.889870896013709 52.875 2 1 "0401" . . . 2 1 "0402" .2451710845064207 1.365255837871846 147.875 2 1 "0503 " . . . 2 1 "0208 " .079804181 1.20318625 8 2 1 "0917" .2106821916942338 1.463362511578329 119.375 2 1 "1301 (1003) " .1352683750778654 2.090110686167636 78.5 2 1 "0210" .1013362406365611 1.020283535152564 190.875 2 1 "0502 " .1478527417681296 1.714796674639336 84.20249999999999 2 1 "0701 " .8935047708333334 8.629122916666667 10.875 2 1 "1404 " .7322294843822921 8.541092816618649 34.25625 2 1 "0404 " .1211358880822747 1.336578321738254 74.625 2 1 "1506 (0914)" .1816664950690817 1.664897581038876 106.375 2 1 "0101 " .3808535388134742 2.567089119029663 39.875 2 1 "0505 " .3850331379183735 4.246376376950773 107.5 2 1 "0915" . . . 2 1 "0407" .2960839776519851 .9816544495709264 45.875 2 1 "1101 (0201) " .5371577241209082 8.252655004936585 31.5 2 1 "0103" .1204280313852814 1.814593343073593 48.875 2 1 "1505" 1.107074055662806 7.986812403474903 58.875 2 1 "1503 " .1214012216712829 1.589424357691893 139 2 1 "0907 " .3605358429055334 1.902175278005166 183.625 2 1 "0303 " .5744495070087033 3.000401317396775 98.265 2 1 "0205 " .016996982 2.878672745 5.3675 2 1 "1404 " .7239095766804513 7.605362496758341 75.625 3 1 "1301 (1003) " .0674639223427435 . 125.875 3 1 "1101 (0201) " .2671287250631313 3.873151162612972 198.25 3 1 "0404 " .3009137006408532 3.285691276418421 195.125 3 1 "0701 " 1.502373416555219 9.206893693354534 90 3 1 "1506 (0914)" .1446290509307822 2.308939004192259 240.75 3 1 "0407" .2962146655762097 .9990996415441177 69.75 3 1 "0210" .1454422451914388 1.858177490391697 308.25 3 1 "0907 " .3245378121412726 4.205627245082444 368.125 3 1 "0401" .4421104173244128 1.69010681427039 143.375 3 1 "0502 " . . 214.125 3 1 "0503 " .1896127803507767 1.230167813176407 149.125 3 1 "0915" .2769027704682041 2.924408491544656 171.125 3 1 "1105 " .154126952268106 1.599266203019975 307.125 3 1 "1505" .3563916074063879 3.511799078548514 94.5 3 1 "0208 " .11126806 .5697555339262187 44 3 1 "0917" .1024385390356601 .7181185242968887 125.625 3 1 "0505 " .1533277929333614 1.920164534456174 168.125 3 1 "0205 " .1512413092868024 .6757475539391675 80.25 3 1 "0303 " . . . 3 1 "0802 " .1443217481560892 . 195.125 3 1 "0402" .1450165625092701 .7956218040987539 374 3 1 "0101 " .1062763059639889 .8728699740977187 142.75 3 1 "1503 " .0741180905422245 .5735472584906742 266 3 1 "0103" .3031954041192885 2.307280389280203 120.75 3 1 "0405 " .3215618464457904 2.036098253644069 50.875 1 2 "1104 (1403) " .5416112094414557 4.228804975030684 152.75 1 2 "1407" .5302095212722586 4.195413691871169 133.375 1 2 "0909 " .4005153054617118 3.760777733506639 47.875 1 2 "0601 " . . . 1 2 "1406" .9077072940211962 9.41137228794756 81.625 1 2 "0703 " . . . 1 2 "1009" .1164260840428785 .640231843210538 122.5 1 2 "0302 " .5306283146856178 3.725720225974645 171.75 1 2 "1002 " . . . 1 2 "1302 " .733131149 6.183931609 7.675 1 2 "1103 (0204) " .2053817702629536 2.197558806067478 68.375 1 2 "0504 " .486456713762383 4.766463092574999 56.36500000000001 1 2 "1007 " .9780011666666666 10.3316375 11.625 1 2 "1601 " .252582438085562 2.095718918624695 81.4825 1 2 "0207 " .045603448 .165517241 5.8 1 2 "0801 " . . . 1 2 "0602" .5832751513401039 4.627267355730298 156 1 2 "1603" .2253974050038832 1.500083316692763 253.625 1 2 "0916" .3579258836673384 3.289629931395234 96.125 1 2 "0905 " .2168245364222466 1.693107443974323 215.63375 1 2 "0206 " . . . 1 2 "1402 " . . . 1 2 "0903 " .2566043439235109 1.111208529278415 175.65 1 2 "0913" .2047018646404274 1.415466627526443 136.5 1 2 end label values visit v1 label def v1 1 "5", modify label def v1 2 "8", modify label def v1 3 "Baseline", modify label values group group1 label def group1 1 "Saline", modify label def group1 2 "Treated", modify
Comment