Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: FW: [...] Stored Data after the calculation


From   keeler james <[email protected]>
To   <[email protected]>
Subject   RE: st: FW: [...] Stored Data after the calculation
Date   Mon, 29 Mar 2010 21:21:24 +0100

In a way, I think, being a new Stata programmer and only started programming for 3 months, I am being bullied by Nick Cox (BTW, is he the moderator?).

I think if I know the answer and/or if I have time to go through all the previous discussions in details back from 2002, I do not need to come here and ask for help. I hope he understands why people are joining Statalist in the 1st place. Is that the reason why this site was being set up for in the 1st place?

Cal 

----------------------------------------
> Subject: RE: st: FW: [...] Stored Data after the calculation
> Date: Mon, 29 Mar 2010 12:53:16 +0100
> From: [email protected]
> To: [email protected]
>
> This was well answered by Martin Weiss, but keeler james or Calchas could have answered part of his or her question by studying the help for -display-
>
> "and", as Martin pointed out, was guessed but illegal syntax.
>
> In addition, -display- does not support -if-. If a command supports -if- it is always explicit in the help.
>
> By the way, I think only the moderator has the right to claim urgency on this list.
>
> Nick
> [email protected]
>
> keeler james
>
> BTW, one more question.
>
> What if the groups are ever changing, e.g. sometimes groups 1 and 4 are missing, and it will end up like the following:
>
> Cohort Tot08 Tot09 A08 A09
>
> Group 2 10   3     0
> ?
> Group 3 3    4     2    ?
> Group 5 3
> 8     0    ?
> Group 6 0    31    0    ?
> Group 7 266  245   181  ?
>
> if we use the same display command -di in r "Second value of A09: " A09[2]-, it will show the value of Group 3 instead of Group 2.
>
> I try in vain to use the following command
>
> di in r if Cohort=="Group 2" and A09!=.
>
> to lock the output to Group 2 but there was an error message. Any help will be great!
>
> Cal
>
>> From: [email protected]
>>
>> Brilliant! Many thanks, Martin - have a good weekend!
>>
>>
>>> From: [email protected]
>
>>> Try this, and switch your mail program to text only... All of this is
>>> discussed in [U], sect. 13.7...
>>>
>>> *******
>>> clear*
>>>
>>> input str7 Cohort int(Tot08 Tot09 A08)
>>> "Group 1" 48 66 17
>>> "Group 2" 10 3 0
>>> "Group 3" 3 4 2
>>> "Group 4" 1 0 0
>>> "Group 5" 3 8 0
>>> "Group 6" 0 31 0
>>> "Group 7" 266 245 181
>>> end
>>>
>>> gen A09=round((A08/Tot08)*Tot09)
>>>
>>> list, noo
>>>
>>> di in r "First value of A09: " A09[1]
>>> di in r "Second value of A09: " A09[2]
>>> di in r "Double the first value of A09: " 2*A09[1]
>>>
>>> *store second value in a -local-
>>> local second=A09[2]
>>> di in r `second'
>>> *******
>>>
>>> From: keeler james [mailto:[email protected]]
>>
>>> Thanks for the prompt response.
>>>
>>> The message attached is my original request, which got bounced back:
>>>
>>> For Group1, the calculated value for A09 is 23.4; for Group2, the calculated
>>> value is 0 and so on for the rest of the groups. But how can I reuse 23.4
>>> (Group 1, A09) in one specific (further) calculation and 0 (Group2, A09) in
>>> a separate (further) calculation?
>>>
>>> I think it should be quite easy, but I just don't know how to do that.
>>>
>>> Calchas
>>> ________________________________________
>>> From: [email protected]
>
>>> I have the following table with column "A09" needed to be calculated.
>>>
>>> Cohort Tot08 Tot09 A08 A09
>>>
>>> Group 1 48 66 17 ?
>>> Group 2 10 3 0 ?
>>> Group 3 3 4 2 ?
>>> Group 4 1 0 0 ?
>>> Group 5 3 8 0 ?
>>> Group 6 0 31 0 ?
>>> Group 7 266 245 181 ?
>>>
>>> I use the command:
>>>
>>> gen A09=round((A08/Tot08)*Tot09)
>>>
>>> This will work well for the missing column "A09", but how can I reuse the
>>> calculated numbers to do further calculations?
>>>
>>> I know it is something relating to the command of stored data, i.e.:
>>>
>>> local missing=r(N)
>>>
>>> but this is only for a scalar value, what about saving and reusing the
>>> entire column? Really stuck at the moment and any help will be appreciated.
>
> *
> * 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/
 		 	   		  
_________________________________________________________________
Do you have a story that started on Hotmail? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index