Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Pei Gao" <pg349@medschl.cam.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu>, <statalist-digest@hsphsun2.harvard.edu> |

Subject |
st: RE: statalist-digest V4 #3797 |

Date |
Sat, 29 May 2010 14:50:29 +0100 |

Sent from my HTC -----Original Message----- From: statalist-digest <owner-statalist@hsphsun2.harvard.edu> Sent: 23 May 2010 08:33 To: statalist-digest@hsphsun2.harvard.edu <statalist-digest@hsphsun2.harvard.edu> Subject: statalist-digest V4 #3797 statalist-digest Sunday, May 23 2010 Volume 04 : Number 3797 ** Send unsubscribe or help commands to majordomo@hsphsun2.harvard.edu ** The digest contains: RE: st: Assigning values from a list Re: st: Assigning values from a list Re: st: How do I graph prediction of mean growth trajectory? [none] Re: st: How do I graph prediction of mean growth trajectory? RE: st: RE: R for Stata Users re: st: assigning values from a list Re: st: How do I graph prediction of mean growth trajectory? Re: st: How do I graph prediction of mean growth trajectory? Re: st: How do I graph prediction of mean growth trajectory? ---------------------------------------------------------------------- Date: Sat, 22 May 2010 20:58:23 +0930 From: marietherese.kelly@flinders.edu.au Subject: RE: st: Assigning values from a list Thank you all, it seems the inlist command will do what I want, I will also check out egen, anymatch. I'll also multiply the DSM codes (disease codes) by 100 like you suggested. * * 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/ ------------------------------ Date: Sat, 22 May 2010 21:21:17 +0930 From: marietherese.kelly@flinders.edu.au Subject: Re: st: Assigning values from a list Sorry I should clarify what var1 and var4 are: When a patient presents to the clinic, they can be diagnosed with at least one but up to 4 diseases, entered into var1-4 as codes from the Diagnostic and Statistical Manual version 9.0. Var1 will always have a value but the remaining var2-4 may or may not be missing, depending on the diagnosis. So if I want to find patients suffering from a group of viral illnesses, I would have to search all 4 variables for the codes 53.20, 54.43 etc up to 76.90 I need to search all var1-4 for every one those codes to make sure I don't miss any cases. But there are many cases where at least one of var2-4 are missing. In that case it might be better to step through through the variables one by one I also tried doing this using a local varlist var1 var2 var3 var4 gen virus=. foreach var in varlist { if virus !=. { replace virus=1 if ((`var'==53.20) |(`var'==54.42) |(`var'==54.43) | /// (`var'==76.00) |(`var'==76.90)) } } command, but I wasn't aware of the command inlist when I wrote that. Similarly if I want to find other groups of diseases (eg fungal infections) I need to search var1-4 for a different list of DSM codes. There are about 20 groups of diseases that I need to identify. To complicate things patients can have multiple diagnoses so I need to make a judgement call about which one is more serious - var1 takes precedence. On Thu, May 20, 2010 at 8:49 PM, <marietherese.kelly@flinders.edu.au> wrote: > Hi All, > I was wondering if someone would help me with a basic programming questions. > > I have 4 variables that are basically DSM codes and I would like to search > through those codes. > > I would like to define lists of diseases and then pick which cases have those > diseases > > So instead of writing > > gen virus=(var1==53.20) |(var1==54.42) |(var1==54.43) | /* > */ (var1==76.00) |(var1==76.90) > > replace virus=((var2==53.20) |(var2==54.42) |(var2==54.43) | /* > */ (var2==76.00) |(var2==76.90)) if virus==. > > replace virus=((var3==53.20) |(var3==54.42) |(var3==54.43) | /* > */ (var3==76.00) |(var3==76.90)) if virus==. > > replace virus=((var4==53.20) |(var4==54.42) |(var4==54.43) | /* > */ (var4==76.00) |(var4==76.90)) if virus==. > > > Repeat for several other categories of diseases - ends up with very long and > confusing code. > > > Is there a way of defining a list eg virus={53.20, 54.42, 54.43, 76.00, 76.90} > > and checking to see whether var1-4 have values in the list? * * 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/ ------------------------------ Date: Sat, 22 May 2010 11:59:12 -0400 From: David Torres <torresd@umich.edu> Subject: Re: st: How do I graph prediction of mean growth trajectory? Thanks, Michael, for the help. I think your suggestion may get my closer to where I need to be. Now I just need to find a quick and easy way to graph it so I can sit back and enjoy some old James Bond movies today. Ciao, Diego - -------------------------------------------- David Diego Torres, MA(Sociology) PhD Candidate in Sociology Quoting Michael Norman Mitchell <Michael.Norman.Mitchell@gmail.com>: > Dear David > > I think that this is a case where the -margins- command could be > your friend. It won't directly draw the graph that you seek, but I > think it will be useful for obtaining the adjusted means that you > could then use for drawing a graph. I have created an example > modeled after your description using the Stata example dataset > -nlswork-. I renamed the v * * 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/

- Prev by Date:
**st: AW: Counting months over several years in a variable** - Next by Date:
**Re: st: AW: Counting months over several years in a variable** - Previous by thread:
**st: Counting months over several years in a variable** - Next by thread:
**st: outreg2 for pgmhaz8** - Index(es):