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: Using Sample Command with Scalar Not Number


From   Aljar Meesters <aljar.meesters@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Using Sample Command with Scalar Not Number
Date   Sun, 20 Jan 2013 15:44:50 +0100

Dear Maisie,

You can use

sample `=A', count

Best,

Aljar



2013/1/20 Maisie Harris <mjh275@georgetown.edu>:
> I am running a loop of code in which I'd like to use the sample
> command, but instead of stating the specific number I want to sample
> I'd like to refer to a previously defined scalar.
>
> A simplified version of what I'm trying to do is:
>
> scalar A=5
> sample A, count
>
> However, when I run the code it says that it finds A when it is
> expecting a number. Is there a simple way to do this? Do I need to
> redefine the scalar somehow?
>
> Thank you
> *
> *   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