Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Conditional statement with multiple string values?


From   "Dimitriy V. Masterov" <dvmaster@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Conditional statement with multiple string values?
Date   Thu, 7 Jun 2012 16:41:10 -0400

The first will never work. The second command should work, but you may
have leading/trailing blanks in your strings. Use the trim function to
get rid of them.

You may also find the inlist() command useful.

DVM


On Thu, Jun 7, 2012 at 4:34 PM, John Whitmer <jcwhitmer@ucdavis.edu> wrote:
> Hello Statamasters,
>
> I'm trying to run a conditional "drop" statement based on multiple values in a string variable.
>
> I tried the following command:
>
>  drop if ACTION_NAME == "topic-viewed” | “organizer-viewed” | “discussion-home-viewed” | “assignments-listed” | “Web-Links-home
>> -viewed” | “folder-selected” | “compile-lm”
>
> And  received the error message "too few quotes".
>
> My quotes are paired ...
>
> Alternatively, I tried the following:
>
> . drop if ACTION_NAME == "topic-viewed” | ACTION_NAME ==“organizer-viewed” | ACTION_NAME ==“discussion-home-viewed” | ACTION_NAM
>> E ==“assignments-listed” | ACTION_NAME ==“Web-Links-home-viewed” | ACTION_NAME ==“folder-selected” | ACTION_NAME ==“compile-lm
>> ”
>
> And didn't get the error message, but there were 0 observations deleted - and this is a monster logfile with a lot of records with these values.
>
> Any ideas?  And I know the severity of the drop statement ...
>
> Best, John
>
>  *********************************************
> John Whitmer
> E: jcwhitmer@ucdavis.edu
> P: 530.554.1528
> C: 530.574.8827
> Skype: john.whitmer
> Virtual Meeting Room:  http://bit.ly/rnBS8u
>
> Discoveries & Reflections on Google+
>
>
>
>
>
>
>
>
>
>
>
>  *********************************************
> John Whitmer
> E: jcwhitmer@ucdavis.edu
> P: 530.554.1528
> C: 530.574.8827
> Skype: john.whitmer
> Virtual Meeting Room:  http://bit.ly/rnBS8u
>
> Discoveries & Reflections on Google+
>
>
>
>
>
>
>
>
> *
> *   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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index