Announcement

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

  • spacing between columns in collect table

    There are a couple of questions I have:

    1. I want to keep median, IQR together while increasing the spacing between the column variable vital. I have tried playing with collect style column option but that is not giving me what I want. What option should I check?
    2. I want to add a new row with its title to nest the three lab values under a title that would be called "Baseline Lab. studies at RT? How would I do that in the tables dialog or using a code?

    This is what I have so far.

    table (var) (vital), ///
    statistic(median agedx) ///
    statistic(iqr agedx) ///
    statistic(fvfrequency female timeperiod raidx2 IPI4 tscons) ///
    statistic(fvpercent female timeperiod raidx2 IPI4 tscons) ///
    statistic(median tsbcreat tsbblr tsbalb) ///
    statistic(iqr tsbcreat tsbblr tsbalb) ///
    nototal

    // Change median and range to two columns rather than stacked
    collect recode result fvfrequency = column1 ///
    fvpercent = column2 ///
    median = column1 ///
    iqr = column2
    collect layout (var) (vital#result[column1 column2])

    collect style cell var[female timeperiod raidx2 IPI4 tscons]#result[column1], nformat(%6.0fc)

    collect style cell var[female timeperiod raidx2 IPI4 tscons]#result[column2], ///
    nformat(%3.1f) sformat("%s%%")

    collect style cell ///
    var[agedx tsbcreat tsbblr tsbalb]#result[column1 column2], ///
    nformat(%4.1f)

    collect style cell ///
    var[agedx tsbcreat tsbblr tsbalb]#result[column2], ///
    sformat("(%s)")

    collect preview
    collect dims
    collect label dim vital "Vital status", modify
    collect label levels var raidx2 "Rai stage at Dx", modify
    collect label list raidx2
    collect label levels var timeperiod "Era of CLL diagnosis (n, %)", modify
    collect label levels var IPI4 "NHL-IPI", modify
    collect label levels var female "Gender", modify
    collect label levels var tsbblr "Ser. Bilirubin at RT (mg/L)", modify
    collect label levels var tsbalbm "Ser. Albumin at RT (g/dL)", modify
    collect label levels var tsbcreat "Ser. Creatinine at RT (mg/L)", modify
    collect label levels var agedx "Age,yrs (IQR)", modify

    collect style header result, level(hide)
    collect preview
    collect dims
    collect label list result, all
    // Row labels

    collect style row stack, nobinder spacer
    collect style column, dups(center) extraspace(1) width(asis)
    collect style cell border_block, border(right, pattern(nil))
    collect preview


    ----------------------------------------------

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte vital float agedx byte female double tsbblr byte(IPI4 timeperiod raidx2) double tsbcreat float tsbalbm
    0  47.32923 1  .4 2 1 0   .8 4.1
    1  62.95962 0  .7 . 2 1 1.05   3
    1  81.36619 0  .4 3 2 1  1.4   4
    0  55.09925 0 1.5 1 2 . 1.03 2.4
    0         . 0   . . 2 .    .   .
    0  66.42026 0  .8 3 1 0   .8 3.9
    1  82.61191 0  .4 2 2 1 2.35 3.9
    0   56.0438 1 1.6 . 1 .   .8 2.8
    0  69.42916 1  .8 3 1 0  1.7 4.2
    1  58.71047 1   1 . 1 0   .7 4.1
    0  59.68241 0  .3 . 2 .  3.2 2.4
    0  38.76523 0  .6 2 1 0    1   1
    0  59.51814 0  .5 1 2 0   .9 4.3
    0  56.35866 0  .5 . 1 0 1.13 4.5
    0   57.5989 1  .4 1 1 .   .7 3.6
    0  45.22656 0  .8 1 1 1   .4 2.6
    0 67.518135 0  .3 3 2 1   .8 4.5
    0   55.0089 0  .6 2 1 0    1 4.3
    1  82.76523 0  .3 3 2 0  1.4 4.1
    0  68.39425 0  .5 3 1 0   .8 3.6
    0  53.94935 0   2 3 0 0    2 3.9
    0  77.76044 0  .4 . 2 .   .8   2
    0  52.35866 1  .3 0 1 0   .6 3.9
    0  60.04107 1 1.1 3 0 0   .9 3.2
    1  48.33402 0  .3 0 1 0    1 4.1
    0  72.76386 0  .6 2 1 0  1.3 4.1
    0  51.18412 0  .5 0 1 1 1.07 2.9
    1 33.952087 0  .6 1 0 .  1.1 3.9
    1  60.75565 0  .2 . 2 0   .7 4.2
    1  54.77892 0 1.7 0 2 .   .9 4.2
    1  54.40657 1 1.8 3 1 0   .5 4.1
    1  66.10541 0   . . 1 .    .   .
    1  75.72348 0  .2 1 2 .  1.2 4.1
    1  60.91444 0   . . 1 .    .   .
    0  54.76249 0  .1 0 2 1    1 2.9
    0    56.282 0  .4 . 1 0   .8 3.2
    0  70.20944 0  .5 3 1 0  1.4 2.3
    1  57.74675 0  .9 3 1 0    1 4.5
    1  53.53593 1  .3 . 0 .  2.3 4.1
    0  53.99589 0  .4 3 1 0   .8 3.5
    0   50.2423 0  .3 . 0 .  1.3 3.6
    0  45.12526 0  .3 1 1 0  1.2 3.9
    0         . 0   . . 1 .    .   .
    1  81.35524 1  .5 2 1 .    1 4.3
    0  49.82615 1 1.2 3 0 .   .5   2
    0   67.8549 0  .5 . 1 .   .8 4.2
    0  67.19507 1 1.6 . 1 0  1.1 3.2
    1   55.1321 0  .5 0 1 0  1.1 3.8
    1         . 0   . . 1 .    .   .
    0  75.65777 0  .3 . 0 .  1.2 3.8
    0         . 0   . . 1 .    .   .
    0   52.5065 1  .4 . 1 1   .5 3.1
    0  61.51403 1  .4 . 1 .   .8 4.5
    1  64.28474 0  .4 1 1 .   .9 3.1
    0  46.59001 0 3.6 2 1 0  1.1 3.5
    0  42.51335 0  .4 . 1 .   .9   5
    0  57.62355 0 2.8 . 0 .    1   4
    1  48.58316 0   . . 1 .    .   .
    1  51.09377 0 1.5 2 1 0  1.1 4.6
    0         . 0   . . 1 .    .   .
    1  60.03286 0 1.2 1 0 .  1.6 4.2
    0   46.6694 0  .8 . 1 .  1.4   4
    0  63.44969 0  .8 . 0 .  2.3 3.6
    0  36.70363 1 1.4 0 0 .   .6 3.8
    0   63.4579 0 1.7 1 0 .   .9 1.9
    1  57.79329 0  .2 . 1 0  1.3 4.3
    1  48.77481 0 6.4 . 1 .    .   .
    1  67.54004 0  .6 . 0 .   .9 4.6
    0  46.48597 0  .8 1 0 .  1.4 4.1
    1  55.33196 0  .6 . 0 1  1.1 3.7
    0  47.93155 1 1.8 2 0 .  1.1 2.2
    0  33.90007 0  .8 0 0 0   .7 3.8
    0         . 0 1.5 . 0 .    1 3.3
    0   48.4627 0 1.2 2 0 1  1.6 2.6
    0  59.72622 0  .4 3 0 0  1.1 4.1
    0         . 1   . . 0 .    .   .
    0    58.705 0 1.9 2 1 .  1.3 3.4
    1   68.3039 0   . . 2 .    .   .
    0  70.49966 0 1.2 2 1 .   .8 3.8
    0  49.35524 0 .81 0 1 0  .89 3.7
    0   59.4579 1  .8 2 1 0  .98 4.1
    1  59.98083 0   . . 1 .    .   .
    1  68.75291 1  .6 . 2 .  .67   3
    1  59.40315 1  .4 0 1 0   .8 4.2
    0  78.97057 1 1.1 1 2 . 2.21 3.9
    0 71.474335 1   . . 2 .    .   .
    1    62.705 0  .3 0 1 0 1.23 3.6
    1  51.25531 1  .7 1 0 1   .9 4.2
    1  56.59411 0  .7 1 2 0    1 4.2
    1  62.90212 0  .5 0 2 1  1.2   4
    0  61.19644 0 1.3 3 2 0  1.2 3.2
    1  70.60917 0 3.7 1 2 0  1.2 4.1
    1 70.428474 1  .5 . 2 1  .69 4.1
    0 67.403145 0 1.4 3 1 0  1.6 2.5
    1  72.74744 0  .9 1 2 .    1 4.4
    0  64.39973 1 .12 . 2 1  .85 3.6
    1 68.520195 0  .8 3 2 1  1.1 4.7
    1 66.464066 0  .4 3 1 .   .7 4.5
    1  66.10541 0   . . 1 .    .   .
    0  60.76934 1   1 2 2 0   .8 4.3
    end
    label values vital vitallab
    label def vitallab 0 "Dead", modify
    label def vitallab 1 "Alive", modify
    label values female genderlbl
    label def genderlbl 0 "Male", modify
    label def genderlbl 1 "Female", modify
    label values IPI4 IPIlab
    label def IPIlab 0 "Low risk (0-1)", modify
    label def IPIlab 1 "Low-Intermediate risk (2)", modify
    label def IPIlab 2 "High-Intermediate(3)", modify
    label def IPIlab 3 "High Risk(4/5)", modify
    label values timeperiod timelab
    label def timelab 0 "Pre-2000", modify
    label def timelab 1 "2001-2010", modify
    label def timelab 2 "2011-2022", modify
    label values raidx2 Lrai
    label def Lrai 0 "Low Stage (0-2)", modify
    label def Lrai 1 "High Stage (3-4)", modify

  • #2
    Girish Venkataraman the code fails because tscons is not included in your data extract. Could you please include that, and run the code once to check there are no other errors?

    Comment


    • #3
      Originally posted by Hemanshu Kumar View Post
      Girish Venkataraman the code fails because tscons is not included in your data extract. Could you please include that, and run the code once to check there are no other errors?
      My bad. I forgot to include tscons (constitutional symptoms) in the dataex. Attached here now.

      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input byte(female timeperiod raidx2 IPI4 tscons) double(tsbcreat tsbblr) float tsbalbm
      1 1 0 2 0   .8  .4 4.1
      0 2 1 . 1 1.05  .7   3
      0 2 1 3 1  1.4  .4   4
      0 2 . 1 . 1.03 1.5 2.4
      0 2 . . .    .   .   .
      0 1 0 3 1   .8  .8 3.9
      0 2 1 2 0 2.35  .4 3.9
      1 1 . . 1   .8 1.6 2.8
      1 1 0 3 1  1.7  .8 4.2
      1 1 0 . 0   .7   1 4.1
      0 2 . . 0  3.2  .3 2.4
      0 1 0 2 1    1  .6   1
      0 2 0 1 1   .9  .5 4.3
      0 1 0 . 0 1.13  .5 4.5
      1 1 . 1 0   .7  .4 3.6
      0 1 1 1 0   .4  .8 2.6
      0 2 1 3 1   .8  .3 4.5
      0 1 0 2 0    1  .6 4.3
      0 2 0 3 0  1.4  .3 4.1
      0 1 0 3 0   .8  .5 3.6
      0 0 0 3 1    2   2 3.9
      0 2 . . 0   .8  .4   2
      1 1 0 0 1   .6  .3 3.9
      1 0 0 3 0   .9 1.1 3.2
      0 1 0 0 1    1  .3 4.1
      0 1 0 2 0  1.3  .6 4.1
      0 1 1 0 0 1.07  .5 2.9
      0 0 . 1 0  1.1  .6 3.9
      0 2 0 . 0   .7  .2 4.2
      0 2 . 0 1   .9 1.7 4.2
      1 1 0 3 0   .5 1.8 4.1
      0 1 . . .    .   .   .
      0 2 . 1 1  1.2  .2 4.1
      0 1 . . .    .   .   .
      0 2 1 0 0    1  .1 2.9
      0 1 0 . .   .8  .4 3.2
      0 1 0 3 1  1.4  .5 2.3
      0 1 0 3 0    1  .9 4.5
      1 0 . . 1  2.3  .3 4.1
      0 1 0 3 1   .8  .4 3.5
      0 0 . . 1  1.3  .3 3.6
      0 1 0 1 1  1.2  .3 3.9
      0 1 . . .    .   .   .
      1 1 . 2 1    1  .5 4.3
      1 0 . 3 1   .5 1.2   2
      0 1 . . 0   .8  .5 4.2
      1 1 0 . 1  1.1 1.6 3.2
      0 1 0 0 1  1.1  .5 3.8
      0 1 . . .    .   .   .
      0 0 . . 1  1.2  .3 3.8
      0 1 . . .    .   .   .
      1 1 1 . 1   .5  .4 3.1
      1 1 . . .   .8  .4 4.5
      0 1 . 1 1   .9  .4 3.1
      0 1 0 2 1  1.1 3.6 3.5
      0 1 . . 0   .9  .4   5
      0 0 . . 1    1 2.8   4
      0 1 . . .    .   .   .
      0 1 0 2 0  1.1 1.5 4.6
      0 1 . . .    .   .   .
      0 0 . 1 0  1.6 1.2 4.2
      0 1 . . 0  1.4  .8   4
      0 0 . . 1  2.3  .8 3.6
      1 0 . 0 1   .6 1.4 3.8
      0 0 . 1 1   .9 1.7 1.9
      0 1 0 . 1  1.3  .2 4.3
      0 1 . . 0    . 6.4   .
      0 0 . . 1   .9  .6 4.6
      0 0 . 1 0  1.4  .8 4.1
      0 0 1 . 0  1.1  .6 3.7
      1 0 . 2 0  1.1 1.8 2.2
      0 0 0 0 1   .7  .8 3.8
      0 0 . . .    1 1.5 3.3
      0 0 1 2 1  1.6 1.2 2.6
      0 0 0 3 1  1.1  .4 4.1
      1 0 . . .    .   .   .
      0 1 . 2 1  1.3 1.9 3.4
      0 2 . . 1    .   .   .
      0 1 . 2 0   .8 1.2 3.8
      0 1 0 0 1  .89 .81 3.7
      1 1 0 2 1  .98  .8 4.1
      0 1 . . .    .   .   .
      1 2 . . .  .67  .6   3
      1 1 0 0 0   .8  .4 4.2
      1 2 . 1 1 2.21 1.1 3.9
      1 2 . . .    .   .   .
      0 1 0 0 1 1.23  .3 3.6
      1 0 1 1 1   .9  .7 4.2
      0 2 0 1 0    1  .7 4.2
      0 2 1 0 1  1.2  .5   4
      0 2 0 3 1  1.2 1.3 3.2
      0 2 0 1 0  1.2 3.7 4.1
      1 2 1 . 1  .69  .5 4.1
      0 1 0 3 0  1.6 1.4 2.5
      0 2 . 1 0    1  .9 4.4
      1 2 1 . 0  .85 .12 3.6
      0 2 1 3 0  1.1  .8 4.7
      0 1 . 3 0   .7  .4 4.5
      0 1 . . 1    .   .   .
      1 2 0 2 1   .8   1 4.3
      end
      label values female genderlbl
      label def genderlbl 0 "Male", modify
      label def genderlbl 1 "Female", modify
      label values timeperiod timelab
      label def timelab 0 "Pre-2000", modify
      label def timelab 1 "2001-2010", modify
      label def timelab 2 "2011-2022", modify
      label values raidx2 Lrai
      label def Lrai 0 "Low Stage (0-2)", modify
      label def Lrai 1 "High Stage (3-4)", modify
      label values IPI4 IPIlab
      label def IPIlab 0 "Low risk (0-1)", modify
      label def IPIlab 1 "Low-Intermediate risk (2)", modify
      label def IPIlab 2 "High-Intermediate(3)", modify
      label def IPIlab 3 "High Risk(4/5)", modify
      label values tscons posneglab
      label def posneglab 0 "Negative", modify
      label def posneglab 1 "Positive", modify

      Comment


      • #4
        New error: variable vital not found.

        Perhaps take just your data extract as another person would, and try running your code on that to check if it returns any errors? Easy to miss out on small things like this.

        Comment


        • #5
          Originally posted by Hemanshu Kumar View Post
          New error: variable vital not found.

          Perhaps take just your data extract as another person would, and try running your code on that to check if it returns any errors? Easy to miss out on small things like this.
          Sheesh...embarrassing indeed Hemanshu Kumar . Thanks for pointing. Followed your advise to run the -dataex- myself first. I cleaned the code design too.

          Code**********************
          // Table Design
          table (var) (vital), ///
          statistic(median agedx) ///
          statistic(iqr agedx) ///
          statistic(fvfrequency female timeperiod raidx2 IPI4 tscons) ///
          statistic(fvpercent female timeperiod raidx2 IPI4 tscons) ///
          statistic(median tsbcreat tsbblr tsbalb) ///
          statistic(iqr tsbcreat tsbblr tsbalb) ///
          nototal

          // Change median and range to two columns rather than stacked
          collect recode result fvfrequency = column1 ///
          fvpercent = column2 ///
          median = column1 ///
          iqr = column2
          collect layout (var) (vital#result[column1 column2])

          collect style cell var[female timeperiod raidx2 IPI4 tscons]#result[column1], ///
          nformat(%6.0fc)

          collect style cell var[female timeperiod raidx2 IPI4 tscons]#result[column2], ///
          nformat(%3.1f) sformat("%s%%")

          collect style cell ///
          var[agedx tsbcreat tsbblr tsbalb]#result[column1 column2], ///
          nformat(%4.1f)

          collect style cell ///
          var[agedx tsbcreat tsbblr tsbalb]#result[column2], ///
          sformat("(%s)")

          collect preview
          collect dims
          collect label dim vital "Vital status", modify
          collect label levels var raidx2 "Rai stage at Dx", modify
          collect label list raidx2
          collect label levels var timeperiod "Era of CLL diagnosis (n, %)", modify
          collect label levels var IPI4 "NHL-IPI", modify
          collect label levels var female "Gender", modify
          collect label levels var tsbblr "Ser. Bilirubin at RT (mg/L)", modify
          collect label levels var tsbalbm "Ser. Albumin at RT (g/dL)", modify
          collect label levels var tsbcreat "Ser. Creatinine at RT (mg/L)", modify
          collect label levels var agedx "Age,yrs (IQR)", modify
          collect label levels var tscons "Constitutional symptoms at RT", modify

          // Hide header levels
          collect style header result, level(hide)
          collect preview
          collect dims
          collect label list result, all

          // Row labels
          collect style row stack, nobinder spacer
          collect style column, dups(center) extraspace(1) width(asis)
          collect style cell border_block, border(right, pattern(nil))
          collect preview




          Code:
          * Example generated by -dataex-. For more info, type help dataex
          clear
          input byte vital float agedx byte(female IPI4 tscons timeperiod raidx2) double tsbcreat float tsbalbm double tsbblr
          0  47.32923 1 2 0 1 0   .8 4.1  .4
          1  62.95962 0 . 1 2 1 1.05   3  .7
          1  81.36619 0 3 1 2 1  1.4   4  .4
          0  55.09925 0 1 . 2 . 1.03 2.4 1.5
          0         . 0 . . 2 .    .   .   .
          0  66.42026 0 3 1 1 0   .8 3.9  .8
          1  82.61191 0 2 0 2 1 2.35 3.9  .4
          0   56.0438 1 . 1 1 .   .8 2.8 1.6
          0  69.42916 1 3 1 1 0  1.7 4.2  .8
          1  58.71047 1 . 0 1 0   .7 4.1   1
          0  59.68241 0 . 0 2 .  3.2 2.4  .3
          0  38.76523 0 2 1 1 0    1   1  .6
          0  59.51814 0 1 1 2 0   .9 4.3  .5
          0  56.35866 0 . 0 1 0 1.13 4.5  .5
          0   57.5989 1 1 0 1 .   .7 3.6  .4
          0  45.22656 0 1 0 1 1   .4 2.6  .8
          0 67.518135 0 3 1 2 1   .8 4.5  .3
          0   55.0089 0 2 0 1 0    1 4.3  .6
          1  82.76523 0 3 0 2 0  1.4 4.1  .3
          0  68.39425 0 3 0 1 0   .8 3.6  .5
          0  53.94935 0 3 1 0 0    2 3.9   2
          0  77.76044 0 . 0 2 .   .8   2  .4
          0  52.35866 1 0 1 1 0   .6 3.9  .3
          0  60.04107 1 3 0 0 0   .9 3.2 1.1
          1  48.33402 0 0 1 1 0    1 4.1  .3
          0  72.76386 0 2 0 1 0  1.3 4.1  .6
          0  51.18412 0 0 0 1 1 1.07 2.9  .5
          1 33.952087 0 1 0 0 .  1.1 3.9  .6
          1  60.75565 0 . 0 2 0   .7 4.2  .2
          1  54.77892 0 0 1 2 .   .9 4.2 1.7
          1  54.40657 1 3 0 1 0   .5 4.1 1.8
          1  66.10541 0 . . 1 .    .   .   .
          1  75.72348 0 1 1 2 .  1.2 4.1  .2
          1  60.91444 0 . . 1 .    .   .   .
          0  54.76249 0 0 0 2 1    1 2.9  .1
          0    56.282 0 . . 1 0   .8 3.2  .4
          0  70.20944 0 3 1 1 0  1.4 2.3  .5
          1  57.74675 0 3 0 1 0    1 4.5  .9
          1  53.53593 1 . 1 0 .  2.3 4.1  .3
          0  53.99589 0 3 1 1 0   .8 3.5  .4
          0   50.2423 0 . 1 0 .  1.3 3.6  .3
          0  45.12526 0 1 1 1 0  1.2 3.9  .3
          0         . 0 . . 1 .    .   .   .
          1  81.35524 1 2 1 1 .    1 4.3  .5
          0  49.82615 1 3 1 0 .   .5   2 1.2
          0   67.8549 0 . 0 1 .   .8 4.2  .5
          0  67.19507 1 . 1 1 0  1.1 3.2 1.6
          1   55.1321 0 0 1 1 0  1.1 3.8  .5
          1         . 0 . . 1 .    .   .   .
          0  75.65777 0 . 1 0 .  1.2 3.8  .3
          0         . 0 . . 1 .    .   .   .
          0   52.5065 1 . 1 1 1   .5 3.1  .4
          0  61.51403 1 . . 1 .   .8 4.5  .4
          1  64.28474 0 1 1 1 .   .9 3.1  .4
          0  46.59001 0 2 1 1 0  1.1 3.5 3.6
          0  42.51335 0 . 0 1 .   .9   5  .4
          0  57.62355 0 . 1 0 .    1   4 2.8
          1  48.58316 0 . . 1 .    .   .   .
          1  51.09377 0 2 0 1 0  1.1 4.6 1.5
          0         . 0 . . 1 .    .   .   .
          1  60.03286 0 1 0 0 .  1.6 4.2 1.2
          0   46.6694 0 . 0 1 .  1.4   4  .8
          0  63.44969 0 . 1 0 .  2.3 3.6  .8
          0  36.70363 1 0 1 0 .   .6 3.8 1.4
          0   63.4579 0 1 1 0 .   .9 1.9 1.7
          1  57.79329 0 . 1 1 0  1.3 4.3  .2
          1  48.77481 0 . 0 1 .    .   . 6.4
          1  67.54004 0 . 1 0 .   .9 4.6  .6
          0  46.48597 0 1 0 0 .  1.4 4.1  .8
          1  55.33196 0 . 0 0 1  1.1 3.7  .6
          0  47.93155 1 2 0 0 .  1.1 2.2 1.8
          0  33.90007 0 0 1 0 0   .7 3.8  .8
          0         . 0 . . 0 .    1 3.3 1.5
          0   48.4627 0 2 1 0 1  1.6 2.6 1.2
          0  59.72622 0 3 1 0 0  1.1 4.1  .4
          0         . 1 . . 0 .    .   .   .
          0    58.705 0 2 1 1 .  1.3 3.4 1.9
          1   68.3039 0 . 1 2 .    .   .   .
          0  70.49966 0 2 0 1 .   .8 3.8 1.2
          0  49.35524 0 0 1 1 0  .89 3.7 .81
          0   59.4579 1 2 1 1 0  .98 4.1  .8
          1  59.98083 0 0 0 1 1  .76 4.5 1.6
          1  68.75291 1 . . 2 .  .67   3  .6
          1  59.40315 1 0 0 1 0   .8 4.2  .4
          0  78.97057 1 1 1 2 . 2.21 3.9 1.1
          0 71.474335 1 . . 2 .    .   .   .
          1    62.705 0 0 1 1 0 1.23 3.6  .3
          1  51.25531 1 1 1 0 1   .9 4.2  .7
          1  56.59411 0 1 0 2 0    1 4.2  .7
          1  62.90212 0 0 1 2 1  1.2   4  .5
          0  61.19644 0 3 1 2 0  1.2 3.2 1.3
          1  70.60917 0 1 0 2 0  1.2 4.1 3.7
          1 70.428474 1 . 1 2 1  .69 4.1  .5
          0 67.403145 0 3 0 1 0  1.6 2.5 1.4
          1  72.74744 0 1 0 2 .    1 4.4  .9
          0  64.39973 1 . 0 2 1  .85 3.6 .12
          1 68.520195 0 3 0 2 1  1.1 4.7  .8
          1 66.464066 0 3 0 1 .   .7 4.5  .4
          1  66.10541 0 . 1 1 .    .   .   .
          0  60.76934 1 2 1 2 0   .8 4.3   1
          end
          label values vital vitallab
          label def vitallab 0 "Dead", modify
          label def vitallab 1 "Alive", modify
          label values female genderlbl
          label def genderlbl 0 "Male", modify
          label def genderlbl 1 "Female", modify
          label values IPI4 IPIlab
          label def IPIlab 0 "Low risk (0-1)", modify
          label def IPIlab 1 "Low-Intermediate risk (2)", modify
          label def IPIlab 2 "High-Intermediate(3)", modify
          label def IPIlab 3 "High Risk(4/5)", modify
          label values tscons posneglab
          label def posneglab 0 "Negative", modify
          label def posneglab 1 "Positive", modify
          label values timeperiod timelab
          label def timelab 0 "Pre-2000", modify
          label def timelab 1 "2001-2010", modify
          label def timelab 2 "2011-2022", modify
          label values raidx2 Lrai
          label def Lrai 0 "Low Stage (0-2)", modify
          label def Lrai 1 "High Stage (3-4)", modify

          Comment


          • #6
            For your question #2, consider throwing this bit of code into the mix:
            Code:
            collect remap var[tsbcreat tsbblr tsbalbm] = var2
            collect label levels var2 tsbcreat "Ser. Creatinine at RT (mg/L)" tsbblr "Ser. Bilirubin at RT (mg/L)" tsbalbm "Ser. Albumin at RT (g/dL)" , modify
            collect label dim var2 "Lab results"
            collect layout (var[female timeperiod raidx2 IPI4 tscons] var2) (vital#result[column1 column2])
            I haven't yet been able to figure out the column spacing bit. Perhaps someone else might know how?

            Comment


            • #7
              Originally posted by Hemanshu Kumar View Post
              For your question #2, consider throwing this bit of code into the mix:
              Code:
              collect remap var[tsbcreat tsbblr tsbalbm] = var2
              collect label levels var2 tsbcreat "Ser. Creatinine at RT (mg/L)" tsbblr "Ser. Bilirubin at RT (mg/L)" tsbalbm "Ser. Albumin at RT (g/dL)" , modify
              collect label dim var2 "Lab results"
              collect layout (var[female timeperiod raidx2 IPI4 tscons] var2) (vital#result[column1 column2])
              I haven't yet been able to figure out the column spacing bit. Perhaps someone else might know how?
              The -collect remap var- worked perfect, Hemanshu Kumar. That was the the harder part for me. The spacing issue, I know I can manually fix in word documents. Perhaps that is why they don't have it as an an option in collect tables?

              Comment


              • #8
                Originally posted by Girish Venkataraman View Post

                The -collect remap var- worked perfect, Hemanshu Kumar. That was the the harder part for me. The spacing issue, I know I can manually fix in word documents. Perhaps that is why they don't have it as an an option in collect tables?
                I just tweaked the last line of your code to include 'Age at diagnosis'. Made me understand the logic of layout even better.

                collect layout (var[agedx] var[female timeperiod raidx2 IPI4 tscons] var2) (vital#result[column1 column2])

                Comment


                • #9
                  I did find a partial solution to the spacing issue yesterday: one can leverage the margin() option to collect style cell. But I wasn't entirely satisfied with what I was able to do. Moreover, it only works when you collect export to pdf or html, not in the other formats, and not in the Stata window when you collect preview.

                  Comment

                  Working...
                  X