If you have a large dataset and want to remove a good chunk of cases – say you have a number of cases that are missing on a key variable – then you can use the following syntax: SELECT IF (NAME ne ‘Dave’ and NAME ne ‘Bob’ and NAME ne ‘Bill’). You can also use the the exact same syntax with string variables by adding ‘ ‘ around the entry that would identify the case you want to remove. SELECT IF (ID ne 653 and ID ne 155 and ID ne 374 and ID ne 416). For example, imagine you also have cases 155, 374, and 416 you want to remove. If you have a few cases rather than just one, the latter syntax may be more efficient to use. For instance, if your VARNAME is ID and the CASE you want to drop is 653, then your syntax would look like this: With this syntax, replace VARNAME with the identifying variables (i.e., the variable that will identify the case you want to remove) and CASE with the specific entry within that variable. If it is just one or a few numerical cases, then a great shorthand is: Notice some outliers or problematic cases in your dataset and want a shorthand way to quickly remove them while also keeping a record of which cases you removed? No problem, there are numerous ways to approach this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |