Announcement

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

  • generate random number using loop

    forv i = 1/10{
    if mod(`i',2)==0 gen z`i' = rnormal()
    if mod(`i',2)==1 gen z`i' = runiform()
    }
    i want to generate random number but i am getting only empty variable list please try to help me

  • #2
    I just run your code, and it works fine
    Did you make sure to have SOME observations in your data file?
    Say
    set obs 100 ?
    Fernando

    Comment


    • #3
      That works for me, but you will need not to start with an empty dataset.

      Code:
      set obs 100
      or whatever before your loop.

      Comment


      • #4
        thanks, it's worked after setting obs value

        Comment


        • #5
          I have employment data of household members having household id and for each household, every member have different member id. data is collected for several times in a year. and there is a separate data file for each year. I want to do analyze the behavior of data with time for each household and also for each member. some data variables are string and others are numerical. so to analyze data what i have to do? merging of data or append different data files.

          Comment

          Working...
          X