Interquartile range to find out outlier & get perfect Standard deviation I have one population dataset -
200, 330, 675, 999, 1200, 3000, 25000

For this dataset IQR = 3000 - 330 = 2670
Also we will get
lower limit = 330 - 1.5(2670) = -3675
Upper limit = 3000 + 1.5(3000 -330) = 7005

From above information How do I find Outlier?
As per the Tukey fences [Q1 - 1.5(Q3 - Q1), Q3 + 1.5(Q3 - Q1)] outside of these limit is outlier.
So I want to calculate standard deviation of above dataset. Then while calculating Standard Deviation, should I have to consider outlier or not.
Here we will get two cases -


*

*Proper standard deviation (when outlier not consider) = 931.60

*Wrong standard deviation (when outlier consider) = 8418.98


So what should I have to consider or is there any other way to get perfect Standard Deviation. As per data set 931.60 is perfect one.
 A: The rule using the IQR is often used with boxplots. Using R statistical
software, we obtain the following:
 x = c(200, 330, 675, 999, 1200, 3000, 25000)
 IQR(x)
 ## 1597.5
 sd(x)
 ## 9093.544
 boxplot(x, horizontal=T)


The vertical line at 200 is the smallest data value above the lower 'fence'; the lower
end of the box is at 502.5; the heavy line inside the box is
the median 999; the upper end of the box is at 2100; the
vertical line at the right end of the upper whisker is at 3000
(the largest data point below the upper fence); and the dot at the
far right is the outlier 25,000.
I got these numbers from boxplot.stats (output shown below
with slight editing):
 boxplot.stats(x)

 $stats  # lower fence, lower hinge, median, upper hinge, upper fence
 [1]  200.0  502.5  999.0 2100.0 3000.0

 $n
 [1] 7  # sample size

 ...

 $out  # list of outliers (here only one)
 [1] 25000

Various books and software may give different values for
the numbers at the ends of the box (lower and upper hinges,
or lower and upper quartiles). This also means that the IQR
can differ from one account to another.
The sample standard deviation is found as $S = \sqrt{\frac{\sum (X_i - \bar X)^2}{n-1}}.$ For a sample as highly skewed as this one, I would
not suppose you are asked to use $S$ to find outliers.
Note: If by the 'perfect' standard deviation, you mean the population
standard deviation $\sigma$, then one sometime says that
data values outside the interval $(\mu - 3\sigma, \mu + 3\sigma)$
is an outlier, where $\mu$ is the population mean. From the
information given, you have no way to know exact values of $\mu$ or
$\sigma.$ Maybe there is something missing from your question.
Addenda prompted by additional questions:
$S$ (computed from all the data) is a reasonably good estimate of σσ if the data are truly random sample from the population. The main issue is whether the outlier really 'represents' the population, or whether it is some sort of mistake (e.g., recording error, equipment failure, etc).    
Example 1: The exponential distribution is a strongly right skewed and samples from it typically show many outliers in the right tail. I just simulated a sample of size 1000 from an exponential population with population mean and SD both 5. There were 27 outliers in the right tail. The sample SD of all 1000 observations was 4.70 (reasonably close to 5).Omitting the outliers, the sample SD was only 3.6.   
Example 2: I simulated a sample of size 1000 from a normal dist'n with pop mean 100 and SD 10. Sample mean 100.3; sample SD 10.2. A few moderate outliers in each tail. I added an outrageous mistaken value of 2000, obviously an outlier. With this bogus observation included the sample SD is 60.9 (far from 10).
The overall lesson is not to discard 'outliers' without good
reason. Check for data input errors. Check lab notes for
indications of measurement difficulty or equipment failure.
There are no general rules.
The question whether to discard an outlier is frequently a
judgment call. Does the 'outlier' represent the target population
or not? In practice, never discard an observation without making
a note that you did so, and why. (And maybe show how analysis differs if outliers are left in.)
