Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Any way to represent the total number of variables in STATA?


From   "Wallace, John" <[email protected]>
To   <[email protected]>
Subject   st: RE: Any way to represent the total number of variables in STATA?
Date   Tue, 3 Apr 2007 10:01:20 -0700

More generally, a wide variety of useful values (current time and date,
current memory, various filenames and paths, etc)are accessible as
c-class values.  Just as you can see which output from a Stata command
or program is available using -return list-, you can get a list of the
c-class values by typing -creturn list-.  You can interactively display
any of those quantities by typing c([valuetype]), as Kelvin showed
below, or you can feed them into do-files or programs by setting a local
macro to them.

Best,
John W.

------------------------------

Date: Tue, 3 Apr 2007 07:20:53 +0100
From: "Kelvin Foo" <[email protected]>
Subject: Re: st: RE: Any way to represent the total number of variables
in STATA?

Another way:

display c(k)

HTH,
Kelvin.


On 4/3/07, Rodrigo Martell <[email protected]>
wrote:
There is most probably a better way to do it but this is what comes to
mind:

describe
local no_vars = `r(k)'
di "`no_vars'"
Hope this helps.


Rodrigo Martell
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Yan Zhang
> Sent: Tuesday, 3 April 2007 2:21 PM
> To: [email protected]
> Subject: st: Any way to represent the total number of variables in
> STATA?
>
>
> Hi, everyone:
>  Does anybody know the way to represent the total
> number of variables in STATA? Just like we use _N to
> represent the total number of observations. Any reply
> will be highly appreciated.
>  Sorry for any inconvenience.
>
> Thanks,

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index