Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: AW: How to add the same block of data to every individual


From   Joseph McDonnell <[email protected]>
To   [email protected]
Subject   Re: st: AW: How to add the same block of data to every individual
Date   Thu, 9 Apr 2009 11:04:46 +0930

Am I missing something? Isn't this just the cross product of the two datasets?

clear
input str1 y byte z
a 7
b 8
c 9
end
tempfile tmp
save `"`tmp'"'

clear
input byte id byte x
1 4
2 6
3 7
end

cross using `"`tmp'"'
sort id y
list, sepby(id)


     +----------------+
     | id   x   y   z |
     |----------------|
  1. |  1   4   a   7 |
  2. |  1   4   b   8 |
  3. |  1   4   c   9 |
     |----------------|
  4. |  2   6   a   7 |
  5. |  2   6   b   8 |
  6. |  2   6   c   9 |
     |----------------|
  7. |  3   7   a   7 |
  8. |  3   7   b   8 |
  9. |  3   7   c   9 |
     +----------------+

Joseph
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index