Statalist The Stata Listserver


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

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


From   "Sergiy Radyakin" <[email protected]>
To   <[email protected]>
Subject   st: Re: flagging a specific pattern of values within observations
Date   Tue, 24 Apr 2007 19:53:08 +0200

I don't know which language does your colleague use for this purpose, but
this can be done quite nicely in Pascal:

procedure TForm1.Button1Click(Sender: TObject);
type TAnswers=set of byte;
var FullSet,v1,v2,v3:TAnswers;
begin
FullSet:=[1,2,3]; v1:=[1]; v2:=[2]; v3:=[3];
if (v1=FullSet-v2-v3) and (v2=FullSet-v1-v3) and (v3=FullSet-v1-v2) then ShowMessage('ok') else ShowMessage('not ok'); //OK
FullSet:=[1,2,3]; v1:=[2]; v2:=[2]; v3:=[3];
if (v1=FullSet-v2-v3) and (v2=FullSet-v1-v3) and (v3=FullSet-v1-v2) then ShowMessage('ok') else ShowMessage('not ok'); //Not OK
end;


In other words, each answer must be the full set of answers minus all the other answers. May be somebody can suggest how
this can be reformulated in terms of Stata's numlists.

Regards, Sergiy


----- Original Message ----- From: "Anirudh V. S. Ruhil" <[email protected]>
To: <[email protected]>
Sent: Tuesday, April 24, 2007 7:17 PM
Subject: st: flagging a specific pattern of values within observations



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

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