[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
siyama@who.int |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: RE: RE: Using postfile |

Date |
Thu, 20 May 2004 18:21:53 +0200 |

Dear Nick, Thanks for your response. I am sorry for the confusion, I want to create a dataset of the matrices created by "matcell", for example: foreach Y in educ sector region { tab hrh `Y', matcell(mat`Y') } My thanks for your help in advance. Amani -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: 20 May 2004 17:26 To: statalist@hsphsun2.harvard.edu Subject: st: RE: Using postfile You can't -post- a whole matrix in this way. -post- is essentially to be used within a loop; each time round the loop you write another line -- another observation -- into the file. In [P] postfile there's an example in which a mean and a sd are posted. I am not clear how your problem differs from wanting a series of tables, in which case the easiest approach is to loop over variables and record the results in a log file. Nick n.j.cox@durham.ac.uk > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of > siyama@who.int > Sent: 20 May 2004 16:11 > To: statalist@hsphsun2.harvard.edu > Subject: st: Using postfile > > > I am struggling with a short programme to create a file of different > cross-tabulations. Here's the program and the corresponding output > using auto.dta > > program hrh > version 8.0 > tempname sim > postfile `sim' str20 matcell using results, replace > tab `1' `2', matcell(matcell) > post `sim' (matcell) > postclose `sim' > end > ************************************************************** > ************* > > sysuse auto > hrh rep78 fore > Repair | > Record | Car type > 1978 | Domestic Foreign | Total > -----------+----------------------+---------- > 1 | 2 0 | 2 > 2 | 8 0 | 8 > 3 | 27 3 | 30 > 4 | 9 9 | 18 > 5 | 2 9 | 11 > -----------+----------------------+---------- > Total | 48 21 | 69 > > type mismatch > post: above message corresponds to expression 1, variable matcell > r(109); > > > I would greatly appreciate any help to what is going wrong!! > Also what must > I add to an ado program to make a running session of stata acknowledge > the modifications I am making. > > Many thanks. > > Amani > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox > Sent: 20 May 2004 16:47 > To: statalist@hsphsun2.harvard.edu > Subject: st: RE: Re: RE: Random number seed > > That's correct. I overlooked the importance of doing in it in batch > mode. It follows that you must change the seed within your do file. > > Nick > n.j.cox@durham.ac.uk > > > -----Original Message----- > > From: owner-statalist@hsphsun2.harvard.edu > > [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Subhankar > > Nayak > > Sent: 20 May 2004 15:41 > > To: statalist@hsphsun2.harvard.edu > > Subject: st: Re: RE: Random number seed > > > > > > You are right. > > Once I open stata and generate random numbers, the seed keeps on > > changing and it is completely randomized. > > > > But since the program is long, I am running it without > opening stata. > > I am running it in the batch mode giving the command > > > > stata -b do market.do > > > > This program opens stata each time and hence gets the same seed and > > the same set of random numbers each time. > > > > Thanks, > > Subh > > > > ----- Original Message ----- > > From: "Nick Cox" <n.j.cox@durham.ac.uk> > > To: <statalist@hsphsun2.harvard.edu> > > Sent: Thursday, May 20, 2004 10:24 AM > > Subject: st: RE: Random number seed > > > > > > > Your premise is false. Just because the seed remains the same does > > > not imply identical samples (of a given size). > > > Conversely, explicitly setting the seed to the same > number as before > > > the last call does ensure an identical sample. > > > > > > However, you can indeed change the seed easily. > > > > > > . search seed > > > > > > points to ways of doing this. > > > > > > More generally, there is a great > > > deal of help on-line, which will > > > save you time. > > > > > > Nick > > > n.j.cox@durham.ac.uk > > > > > > > -----Original Message----- > > > > From: owner-statalist@hsphsun2.harvard.edu > > > > [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of > > Subhankar > > > > Nayak > > > > Sent: 20 May 2004 15:16 > > > > To: statalist@hsphsun2.harvard.edu > > > > Subject: st: Random number seed > > > > > > > > > > > > Can the stata random number seed be itself randomized? > > > > > > > > I am running a program called "market.do" in the batch > > mode without > > > > invoking/opening stata. This program carries out an > analysis based > > > > on a set of 1,000 uniform random numbers it generates. > > > > > > > > However, since the random seed is always the same > > everytime I run the > > > > program in batch mode, I get the same set of 1,000 > random numbers > > > > each time I run this program in batch mode. Results are > identical > > > > which defeats the purpose. > > > > > > * > > > * For searches and help try: > > > * http://www.stata.com/support/faqs/res/findit.html > > > * http://www.stata.com/support/statalist/faq > > > * http://www.ats.ucla.edu/stat/stata/ > > > > > > > > > * > > * For searches and help try: > > * http://www.stata.com/support/faqs/res/findit.html > > * http://www.stata.com/support/statalist/faq > > * http://www.ats.ucla.edu/stat/stata/ > > > > * > * For searches and help try: > * http://www.stata.com/support/faqs/res/findit.html > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/support/faqs/res/findit.html > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**RE: st: Re: Transparent background in graphics** - Next by Date:
**st: RE: RE: RE: Using postfile** - Previous by thread:
**st: RE: Using postfile** - Next by thread:
**st: RE: RE: RE: Using postfile** - Index(es):

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