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

st: Re:Is there any way ?


From   "victor michael zammit" <[email protected]>
To   <[email protected]>
Subject   st: Re:Is there any way ?
Date   Sat, 11 Sep 2004 12:03:06 +0200

Dear Statalist,
the following dataset lists the 16 variables , out of 1000  normally
distributed variable with mean 50 and standard deviation 10  , and then  <
keep if  mean>49.9 & mean < 50.1 & sd > 9.9 & sd< 10.1 > .  I would like to
do this  for different  < set obs # > ,and 10,000 instead of  1000  , but
memory becomes an issue .What I thought I could do , is to save  variable i
' s  under a different name, and then go to the  next  <set obs #> and <
save,replace> over the previous 1000 or whatever  variables .

+---------------------------+
mean         sd     i
---------------------------
1.  49.96996   9.978514    76
2.  49.92636   10.07861   118
3.  49.97271   10.07149   122
4.  50.07562   10.07239   218
5.  49.94316   9.913686   220
---------------------------
6.  50.02873   10.05811   346
7.  50.01596   10.04384   442
8.  50.00026   9.943673   513
9.  49.91186    9.95947   533
10.  50.00311   10.00525   629
---------------------------
11.  50.09705   9.929688   653
12.  49.98079   10.04592   678
13.  49.93727   9.962771   686
14.  49.98563   10.07247   694
15.  50.08827   9.936735   833
---------------------------
16.  49.97584   10.05994   854


I experimented with a loop :


. local i = 1

. while `i'<= _N  {
2. use  ai[`i'].dta,clear
3. save b`i',replace
4. local i = `i'+1
5. }
weights not allowed
r(101);

but it did not work
Is there a way I could do this ?
I would like to thank you in advance
Victor Michael Zammit



*
*   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