Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Organizing data by date

    Hello, My data file includes a functional health score, a breathing test score, and dates that subjects submitted each of these scores. Currently the data are organized by 'time' of response within each subject (first time responding, second time responding, etc.). I would like to line up responses by date within each subject so that the date of the functional health score and the date of the breathing test score align. What would be the code to line up responses by date? The data are copied in dataex format below along with a screenshot of the format I intend to create. (Please note that the long format of this data file, and the string format of the functional health scores and breathing test scores are deliberate.) Thanks!

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int subject_id float(time function_response breath_response) str5 function_score str35 breath_score
     36 1 21958 21958 "35" "80" 
     36 2 22177 22177 "38" "84" 
     36 3 22200 22200 "38" "80" 
     68 1 21958 21958 "39" "92" 
     68 2 22189 22189 "39" "85" 
     68 3 22198 22349 "38" "91" 
     68 4 22349 22451 "38" "90" 
     68 5 22451 22470 "36" "89" 
     68 6 22470 22525 "39" ""   
     68 7 22525 22594 "38" "91" 
     68 8 22594 22620 "39" "90" 
     68 9 22620     . "38" ""   
    329 1 21979 21979 "40" "98" 
    329 2 22176 22176 "40" "100"
    329 3 22449 22449 "37" "100"
    329 4     . 22527 ""   "100"
    333 1 21979 21979 "16" "59" 
    333 2 22151 22151 "16" "59" 
    333 3 22214 22214 "19" "49" 
    333 4 22593 22435 "19" "49" 
    333 5     . 22593 ""   "52" 
    348 1 21979 21979 "37" "94" 
    348 2 22178 22594 "33" ""   
    348 3 22208     . "32" ""   
    348 4 22594     . ""   ""   
    end
    format %td function_response
    format %td breath_response
    Click image for larger version

Name:	Screenshot.PNG
Views:	2
Size:	51.3 KB
ID:	1679007
Working...
X