Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: RE: Re: RE: Re:Is there any way ?


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: RE: Re: RE: Re:Is there any way ?
Date   Tue, 14 Sep 2004 13:12:41 +0100

Try the following...

 levels i, local(lev)
 foreach i of local lev {
 	copy a`i'.dta b`i'.dta
 }

David
[email protected]

-----Original Message-----
From: victor michael zammit [mailto:[email protected]]
Sent: 14 September 2004 09:47
To: [email protected]
Subject: st: Re: RE: Re: RE: Re:Is there any way ?


My operating system is Windows95 .What I am trying to do is to the following
:
After having generated ,say, 1000 normally distributed variables with mean
50 and standard deviation 10 ; from this I
derived three variables : mean  , sd  and i , where sd stands for standard
deviation and i stands for the variable number.Then I implement the command
:             keep if  mean > 49.9 & mean < 50.1 & sd> 9.9 & sd< 10.1
which gives me the following list :

+----------------------------+
mean         sd      i
----------------------------
1.  49.98775   9.995832    101
2.  49.92238   9.921903    140
3.  50.04274   9.959353    237
4.  49.91986   10.02384    267
5.  50.06425   10.03112    307
----------------------------
6.  50.09529   9.923013    353
7.  50.07205   9.926955    363
8.   49.9694   10.00273    365
9.   49.9058   9.911177    391
10.  49.95581   10.05547    400
----------------------------
11.  50.08439   10.07163    415
12.  50.03706   10.02582    428
13.  49.93437   9.979973    437
14.  49.95476     10.009    456
15.  49.99855    9.99959    545
----------------------------
16.  50.08477   9.915329    559
17.  50.09824    9.93272    564
18.  49.99771   10.01748    574
19.  50.02956   10.07592    589
20.  49.96579   10.06241    614
----------------------------
21.  49.96054   10.04056    649
22.  50.03897   9.999675    747
23.  50.03214   9.958685    751
24.  49.91431   9.926854    778
25.  50.02348   9.960877    820
----------------------------
26.   50.0564   9.956045    896
27.  50.00867   9.907173    964
28.  50.02766   9.918256   1000
+----------------------------+
Please note that I have saved each of the 1000  variables   under  a1.dta,
a2.dta , a3.dta, ....  , a1000.dta  , but at the point of saving them, I do
not know  ,which variables are consistent with my imposed constraints.The
above list makes it clear however which are the right variables .Therefore I
know that  : a101.dta , a140.dta, a237.dta, ........ a964.dta , a1000.dta
are variables with  mean and standard deviation  that fall within the
criteria of   49.9< mean<50.1 & 9.9<sd<10.1 .
What I Want is to know if there is such a thing as going back to the
individual datasets, a101.dta, a140.dta, ...... , a1000.dta
and install them again , automatically (not manually) , in the directory
under a different name  such as  b101.dta, b140.dta, ....., b1000.dta , such
that , later on I could write over the a1.dta, a2.dta, a3.dta, ...
,a1000.dta and still have access to the  variables that are of interest to
me.
Please bear with me if I am still unclear as to what I want .
Thank you before hand,
Victor Michael Zammit



----- Original Message -----
From: Nick Cox <[email protected]>
To: <[email protected]>
Sent: Monday, September 13, 2004 11:37 AM
Subject: st: RE: Re: RE: Re:Is there any way ?


> This renaming of files is largely between you
> and your (still unstated) operating system,
> although Stata is available as an intermediary.
>
> For example, under the Windows XP command prompt,
> rename can be used to rename files. From within
> Stata
>
> !rename a76.dta b76.dta
>
> will do the same thing.
>
> Nick
> [email protected]
>
> victor michael zammit
>
> > I am using version 8.2
> > What I am trying to do is to isolate  normally distributed
> > variables closest
> > to a mean of 50 and a sd of 10.
> > The following clip is from a generation of 1000 such
> > variables . 76 and 833
> > are  variables that qualify to the relevant criteria  .They
> > are saved in my
> > directory as  a76.dta    and  a833.dta  respectively .
> > mean         sd     i
> > > > ---------------------------
> > > > 1.  49.96996   9.978514    76
> > ......................
> > > > 15.  50.08827   9.936735   833
> >
> > What I need is a code that is capable of (for example) ,
> > renaming   a76.dta
> > ,   b76.dta  &  a833.dta ,  b833.dta  , and thus being able
> > to freely write
> > over the previous   a1.dta , a2.dta   ..... a1000.dta ,  to
> > handle other
> > criteria , while conserving   memory .
>
> *
> *   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/



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