Assuming your variable is mpg, and your scalar is 20.  Then how about 
something like:
count if mpg>20
local a = r(N)
count if mpg<20
local b = r(N)
count if mpg==20
local e = r(N)
di (`b'+`e'/2) / (`a'+`b'+`e')
That is, count how many observations are below s, how many above, and how 
many are equal.  Then the percentile is just the number below, and half of 
the ties, over the total N.
--Nick Winter
At 06:46 PM 7/25/2005, you wrote:
Hi, I have a question regarding percentiles that I've been having some 
trouble with...suppose that you have a variable x, and you have a scalar 
s, and you'd like to know at about what percentile of the x variable the s 
scalar falls.  For instance, suppose x=1,2,3,...,1000.  Then if you have 
s=20, it should be assigned the percentilie value of the 2nd 
percentile.  Is there a way to do this easily in stata? (I wanted to 
assign the scalar a n approximate percentile EVEN IF IT'S NOT A VALUE in 
the variable itself so it can't be located in there)  Everything I could 
think of would take quite a while.
Thank you for your help,
Florence
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
--------------------------------------------------------
Nicholas Winter                           607.255.8819 t
Assistant Professor                       607.255.4530 f
Department of Government              [email protected] e
308 White Hall            falcon.arts.cornell.edu/nw53 w
Cornell University
Ithaca, NY 14853-4601
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/