Hello again,
I apologize that my query still lacks clarity. I will go back to auto.dta,
for example there are two tabulations below:
tab rep78 for, matcell(new)
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
tab rep78 wg, matcell(newg)
Repair |
Record | wg
1978 | 0 1 | Total
-----------+----------------------+----------
1 | 0 2 | 2
2 | 0 8 | 8
3 | 1 29 | 30
4 | 5 13 | 18
5 | 1 10 | 11
-----------+----------------------+----------
Total | 7 62 | 69
matrix list new
new[5,2]
c1 c2
r1 2 0
r2 8 0
r3 27 3
r4 9 9
r5 2 9
matrix list newg
newg[5,2]
c3 c4
r1 0 2
r2 0 8
r3 1 29
r4 5 13
r5 1 10
I wish to output the content of the matrices "new" and "newg" to one dataset
(or *.txt) whose records will be r1-r5 and variables will be c1 c2 c3 c4.
I hope that is clearer and my apologies for the confusion once again.
Best regards,
Amani
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 20 May 2004 18:31
To: [email protected]
Subject: st: RE: RE: RE: Using postfile
Sorry, I don't know what you
have in mind by a dataset of matrices.
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of
> [email protected]
> Sent: 20 May 2004 17:22
> To: [email protected]
> Subject: st: RE: RE: Using postfile
>
>
> 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: [email protected]
> [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: 20 May 2004 17:26
> To: [email protected]
> 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
> [email protected]
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]]On Behalf Of
> > [email protected]
> > Sent: 20 May 2004 16:11
> > To: [email protected]
> > 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: [email protected]
> > [mailto:[email protected]] On Behalf Of Nick Cox
> > Sent: 20 May 2004 16:47
> > To: [email protected]
> > 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
> > [email protected]
> >
> > > -----Original Message-----
> > > From: [email protected]
> > > [mailto:[email protected]]On Behalf Of
> Subhankar
> > > Nayak
> > > Sent: 20 May 2004 15:41
> > > To: [email protected]
> > > 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" <[email protected]>
> > > To: <[email protected]>
> > > 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
> > > > [email protected]
> > > >
> > > > > -----Original Message-----
> > > > > From: [email protected]
> > > > > [mailto:[email protected]]On Behalf Of
> > > Subhankar
> > > > > Nayak
> > > > > Sent: 20 May 2004 15:16
> > > > > To: [email protected]
> > > > > 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/
>
*
* 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/