在Stata中遇到“string variables may not be used as factor variables”这一错误时,通常意味着你尝试将字符串类型的变量用作因子变量,但Stata不支持这样做。为了解决这个问题,你可以按照以下步骤操作: 理解错误原因: 这个错误表明你尝试在回归分析或类似需要使用因子变量的命令中使用了字符串类型的变量。Stata要求因...
Stata会报错如下。 line cpi time string variables not allowed in varlist; time is a string variable 因此我们如果要在Stata中处理时间变量,第一件事就是要把文本格式的时间,转换成Stata可以识别的格式。转换的命令叫做date,其格式是: date(s1,s2),其中s1是文本格式的时间变量,s2是文本格式时间的年月日的...
Subject Re: st: Loading long string variables (from SQL) into Stata Date Thu, 6 Dec 2012 09:35:56 +0000That's good: you can imagine a strategy. In detail: there's no guarantee that words would be split in the middle. Also, there is no need to create new variables as (e.g.) ...
Stata报错。 . tsset TIMESTAMP //出现错误。因为该变量是字符串型 string variables not allowed in varlist; TIMESTAMP is a string variable r(109); 这是因为这个变量本来就是字符型,不是日期型,不能直接当日期型变量使用。所以我们需要对这个变量进行转换。 TIMESTAMP变量转换使用clock函数。 *第一步,通过c...
Here the result ofcountis left behind inr(N). If that is not zero, i.e., ifr(N)is one or more, Stata enters thewhileloop. We remove the first zero whenever there is one andcountagain. Stata will exit the loop as soon asr(N)becomes zero. A similar technique could be used to rem...
string var..string variables not allowed in varlist;month is a string variable设置面板数据的时候出现的,应该怎么调整month数据才行?
tabstat a b c d,stats(mean median) //会显示string variables not allowed in varlist;d is a string variable 意思是d是字符串变量(不是数值变量),不能观察它的平均值和中位数 *---* split 分割示例,p("年""月""日""元""角""分") //根据“年”“月”“日”“元”“角”“分”分割字符串...
如果数据中不需要它,则将其编码为缺失(虽然在缺少数据的意义上它并不缺少,但数据是完美的)。当v3丢失时,我希望Stata将上面的表达式当作v3的术语不存在,所以在这些情况下,我只希望它将这些观察的表达式处理为:当我运行这个时,stata说: starting values invalid or some RHS variables have missing values...
status_t1 is a string, status_t1_num is a long; in both cases, the sortby() option returns the same error message: . sankey cdr_flows_ if month_num>=4, from(status_t1) to(status_t2) by(month_num) sortby(status_t1) not sorted r(5); . sank...
一、Stata分类变量数据处理 1.1 数据标记label define+ label value Stata通常不直接标记某个变量为分类变量。在Stata的基础数据类型里面,除了日期型,就剩下字符串型和数值型。后两种变量类型刚好对应分类变量的两种表示方法。而且,这两种编码还可以通过取值标签(label define+value)对应起来。下面我们举一个最最简单的...