Announcement

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

  • Keep zero as first number

    Hello everybody

    I am trying to import numbers ( as string variable ) from Excel to Stata in format 0123456, but the zero if it is on the first place in Excel, in Stata it is disappeared.
    How can I solve it ?

    Thank you in advance
    T.N.

  • #2
    So, on the assumption that all of your numbers, like the example you show, are 7 digits (including the leading zero), once the data are imported:
    Code:
    format name_of_variable %07.0f
    This will force the display of the variable to be 7 digits long, and, if necessary, it will be left-filled with leading zeroes.

    Comment


    • #3
      Thank you very much Professor Schechter !!!

      Comment


      • #4
        Hello again

        I am trying to estimate a regression analysis but there should be correlated the dep. var. Yt with the independent vars X1(t-1) and X2(t-1), thus to correlate the dependent variable of year t, with the independent variables X1 and X2 of the previous year.
        Is there a special command?

        Thank you in advance
        T.N.

        Comment


        • #5
          This question is unrelated to the original topic of this thread. While it is easy to think of these threads as conversations between a questioner and a responder, they are more than that. People with questions often come to the Forum and search on the topic, as their question may have been previously asked and answered by somebody. And other people browse the Forum and choose which threads to read based on the topic. In order to avoid having these types of Forum readers waste their time reading material that is irrelevant to them, or miss finding something that is relevant but buried in a thread with a misleading title, it is important to keep these threads on topic.

          Please repost your question as a new topic and use a title that is descriptive of what you are asking about.
          Last edited by Clyde Schechter; 22 Apr 2023, 14:57.

          Comment


          • #6
            Thank you, it is my mistake. I have already posted in a new topic.

            Comment

            Working...
            X