Reputation: 21
I want to know how to calculate in Stata the total number of columns and rows in a .dta or dataset.
For example, in R language, I know there are two commands "nrow" and "ncol", which returns the number of columns and rows in a dataset. The "dim" command gives the dimensions of the table.
Can anyone please help me what command I should use?
Edit 1: There is a command to count the number of observations (rows), i.e. count
. I guess there might be a command to give me number of variables (columns).
Edit 2: I am terribly sorry for causing such ruckus over something simple. I found the command finally. It was basically a function di c(k)
that returns the row numbers. My apologies.
Upvotes: 2
Views: 8465
Reputation: 37233
A plain
describe
gives this information. See also the results of
creturn list
The number of observations is also accessible as _N
.
Upvotes: 2