Announcement

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

  • Display from SIF to HRF only one number

    Hi there,

    Is there a quick check on knowing what date is a number in SIF form? I am just trying to check some numbers from time to time, not whole variables as it is shown in the manuals. Ideally i would like to use the comand display in this way:
    display "functionfromSIFtoHRF"(SIF number, format)

    or

    display "functionfromSIFtoHRF"(SIF number) %format
    I haven't find such a function so any help would much appreciated.

    KR

  • #2
    No function is necessary, display accepts format specifications. (See the output of help display for details.)
    Code:
    . display td(1jan2020)
    21915
    
    . display %td 21915
    01jan2020

    Comment


    • #3
      Many many thanks!!! I actually tried: di 21915 %td.... poor fool of me.

      Comment


      • #4
        display works left to right, as usual. So, to spell it out: 21915 is first echoed back at you. Then display ignores what follows. Roughly speaking a display format followed by nothing makes no difference to what is displayed, namely nothing.

        Last edited by Nick Cox; 02 Oct 2019, 09:40.

        Comment


        • #5
          ... while format works in either order
          Code:
                  format varlist %fmt
                  format %fmt varlist
          leading unsuspecting users to perhaps without thinking mimic the first variant of the format syntax when composing a display command.

          Comment


          • #6
            Good point. I have no information but it wouldn't surprise me if someone at StataCorp got irritated because without looking at the help for format they guessed wrong about what comes first. Or users kept doing that. And it seemed simpler to allow either order.

            But display is indeed quite different. Its modus operandi is only to execute chunk by chunk. There has to be some look-ahead for the syntax to work.

            Comment

            Working...
            X