Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: flagging a specific pattern of values within observations


From   Friedrich Huebler <[email protected]>
To   [email protected]
Subject   Re: st: flagging a specific pattern of values within observations
Date   Tue, 24 Apr 2007 11:08:56 -0700 (PDT)

This should do it.

input fid q11a q11b q11c
55 2 3 1
21 1 2 1
end
gen q = string(q11a) + string(q11b) + string(q11c)
gen tag = !(inlist(q,"123","132","213","231","312","321"))

Friedrich

--- Alan Neustadtl <[email protected]> wrote:
> Makes sense...thanks for finding the flaw.
> 
> Best,
> Alan
> 
> On 4/24/07, Sergiy Radyakin <[email protected]> wrote:
> > No, this will not work(2-2-2):
> >
> > ----------------------------
> > fid     q11a    q11b    q11c
> > 55      2        3       1
> > 21      1        2       1
> > 22      2        2       2
> > ----------------------------
> >
> > Prime numbers seem to be a better idea.
> >
> > Best,
> >   Sergiy
> >
> >
> > ----- Original Message -----
> > From: "Alan Neustadtl" <[email protected]>
> > To: <[email protected]>
> > Sent: Tuesday, April 24, 2007 7:30 PM
> > Subject: Re: st: flagging a specific pattern of values within
> observations
> >
> >
> > > How about something like this:
> > >
> > > clear
> > > input fid q11a q11b q11c
> > > 55  2 3 1
> > > 21  1 2 1
> > > end
> > >
> > > tempvar checkit
> > > egen `checkit'=rowtotal(q11a q11b q11c)
> > > generate byte flag=1 if `checkit' !=6
> > > list if flag==1
> > >
> > > Best,
> > > Alan
> > >
> > >
> > > On 4/24/07, Anirudh V. S. Ruhil <[email protected]> wrote:
> > >> A colleague is trying to accomplish something in a different
> stats
> > >> package
> > >> and asked if STATA could effect the solution. "Of course",
> said I. Now I
> > >> am
> > >> scratching my head for the code.  Individuals were asked to
> rank-order 3
> > >> choices. Person 55 did fine, but not Person 21. How can I
> generate a flag
> > >> for such respondent-errors?
> > >>
> > >> ----------------------------
> > >> fid     q11a    q11b    q11c
> > >> 55      2               3       1
> > >> 21      1               2       1
> > >> ----------------------------
> > >>
> > >> thanks in advance
> > >>
> > >> Ani


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   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