Bookmark and Share

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]

Re: st: If condition for restricting data starting with certain values like 45


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: If condition for restricting data starting with certain values like 45
Date   Sun, 5 Jan 2014 09:47:37 +0000

<>

You seem to be reaching for

... if inlist(substr(string(id), 1, 2), "45", "74", "63")

Notes:

1. -if- used in this way is called a qualifier, not a command.

2. See help on the functions -string()-, -substr()-, -inlist()-.

3. See also http://www.stata-journal.com/article.html?article=dm0058
for an introductory tour of functions.
Nick
[email protected]


On 5 January 2014 02:15, Veeresh Thummadi <[email protected]> wrote:
> Hi
>
> I have a question regarding how to restrict values using if command
> with dynamic values. For instance there are players with ids 45**. So
> I want to tabulate all players with starting rank as 45, 74 and 63.
> How will I do that using if condition statement. The format for the
> rank variable is integer.
>
> Thanks
> Veeresh
>
> Veeresh Thummadi
> Research scientist
> Stern School of business
> New York University
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index