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]
st: RE: identifying highest number of consecutive variables where answer is consistent across observation
From
Joe Canner <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: RE: identifying highest number of consecutive variables where answer is consistent across observation
Date
Thu, 20 Feb 2014 17:11:29 +0000
Alison,
When you say "in a row" do you mean "consecutively" or are you referring to rows in the Stata sense (all of the variables for an observation)?
Regards,
Joe Canner
Johns Hopkins University School of Medicine
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Alison El Ayadi
Sent: Thursday, February 20, 2014 12:04 PM
To: [email protected]
Subject: st: identifying highest number of consecutive variables where answer is consistent across observation
Hi -
I am doing some data cleaning on survey data and am looking to identify observations where there are 15 or more of the same answers in a row (across the variables in current order). All of the variables are string. Does anyone have an easy automated way to do this? I'm thinking that it could be done by generating a variable that provided the maximum number of same responses in a row, but have no idea how to code this. Variables are q1 - q94, and all string.
Any suggestions on efficiently writing this code would be greatly appreciated.
Best,
Alison
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/