matrix stata local r-rownames 1个回答 0投票 语法是一次性分配所有行名称。因此,您需要将最后一条语句从循环中取出。 mat WALD = J(4, 2, 0) forval c = 0/3 { local z = 3 + `c' local names `names' _`c'_`z' } matrix rownames WALD = `names' mat li WALD WALD[4,2] c1 ...
say, a 1 for e(TR) and 2 for e(TC)), resulting in an (R + C) x (j +1) matrix, and then export the matrix, with rownames, to an ASCII comma-separated file. Can this be done and how? * * For searches and help try: *http://www.stata.com/support/faqs/res/findit.html ...
local names : rownames M gen str rown = "`names'" and got the variable rown, but it's blank. I also used gen str rown = `names' but got an error message saying Frag300 not found. How do I save the row names as a variable? I'm using Stata 10 on a Vista machine. * * ...
sexis stored as a numeric variable, so I can usedecodeto create a string variable calledsex_s. I could omit this step ifsexwas stored as a string variable. Next, I uselevelsofto store the levels ofsex_sto the local macrosexlabels. Then, I usematrix rownamesto label the ...
egen m=rowmiss(_all) drop if m>0 <hr/>stata中如何写命令将原本为缺失值“.”的换成0值 replace var1=0 if var1==. 好像可以这么做: mvdecode var1-var5, mv(0=.) mvencode var1-var5, mv(.=0) 如果用上述方法替换不了的话,可以采用强制替换命令: mvencode _all, mv(0) over...
我们在Stata中使用矩阵时,有时需要给它们一个自定义的名称,这时我们在命令matrix后面分别添加命令rownames和colnames就能完成对矩阵行和列的命名。在Stata中对于任意一个新读入的矩阵,系统会自动赋予行名和列名,分别为r1,r2,…;c1,c2,…。 首先读入矩阵A并且展示一下矩阵A,可以看到矩阵A的行名称和列名称分别为r1,...
. matrix colnames VCE = weight length _cons . matrix rownames VCE = weight length _cons Finally, tell Stata to use the coefficient vector from the estimation on the full sample, along with the new variance–covariance matrix, and display the results. ...
matrix rownames sample1 = `r(name1)' `r(name2)' `r(name3)' Total . matrix list sample1 sample1[4,2] yes no 20 60 40 21 50 50 22 55 45 Total 52 48 Are there alternatives to the commands that create the matrix and assign row names? There should be commands that do not ...
To statalist@hsphsun2.harvard.edu Subject Re: st: How to create a blank n x n matrix; how to refer to variables without using ID; how to extract colnames and rownames from the dataset. Date Wed, 9 Mar 2011 13:06:51 +0000 (GMT)-...