Announcement

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

  • Is forvalues inconsistently inclusive?

    Is this behavior inconsistent or am I missing something?

    Code:
    . forv x = 0(0.05)1{
      2.         di `x'
      3. }
    0
    .05
    .1
    .15
    .2
    .25
    .3
    .35
    .4
    .45
    .5
    .55
    .6
    .65
    .7
    .75
    .8
    .85
    .9
    .95
    
    . forv x = 0(0.5)1{
      2.         di `x'
      3. }
    0
    .5
    1
    Why does 0(0.05)1 terminate at 0.95 whereas 0(0.5)1 terminates at 1?

  • #2
    The answer you seek lies here.

    Comment


    • #3
      Thanks. I had a feeling the problem was along those lines. @Nick Cox's article, as usual, is very instructive.

      Comment


      • #4
        Ali Atia Yep yep!!! Dr. Cox is a Stata magician wizard sage. His code has saved me many times.

        Comment

        Working...
        X