Announcement

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

  • Suppressing small values

    Hi all - is there a way to suppress small values in output? I work on a large cohort study and we suppress all values <5 for identifiability reasons. So far we Stata users have been either changing them manually, or exporting results to an excel file, importing that file back in with values as strings, and replacing "1", "2", "3", or "4" as "<5". However, if there is a command or program to run, this would be very helpful! Thanks!

  • #2
    Kristen:
    welcome to this forum.
    I'm not sure I got you right, so please consider what follows as a temptative reply:
    Code:
    . set obs 5
    Number of observations (_N) was 0, now 5.
    
    . g value=_n
    
    . list
    
         +-------+
         | value |
         |-------|
      1. |     1 |
      2. |     2 |
      3. |     3 |
      4. |     4 |
      5. |     5 |
         +-------+
    
    . tostring value, g (string_value)
    string_value generated as str1
    
    . replace string_value="<5" if value<5
    variable string_value was str1 now str2
    
    
    . list
    
         +------------------+
         | value   string~e |
         |------------------|
      1. |     1         <5 |
      2. |     2         <5 |
      3. |     3         <5 |
      4. |     4         <5 |
      5. |     5          5 |
         +------------------+
    
    .
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      In general, no there is not. Some community-contributed commands may offer this ability (e.g., -basetable- from SSC by Niels Henrik Bruun).

      So far we Stata users have been either changing them manually, or exporting results to an excel file, importing that file back in with values as strings, and replacing "1", "2", "3", or "4" as "<5".
      This may be able to be achieved using programming, depending on the specifics on what the output is, and how you ultimately need to export it.
      Last edited by Leonardo Guizzetti; 02 Mar 2022, 12:55.

      Comment

      Working...
      X