egen 命令应用系列——1.合并两个变量concat()函数

来源:互联网 发布:mac select会员 编辑:程序博客网 时间:2024/05/16 10:26

egen是Stata中非常实用的一个命令,由于包含大量可以连用的函数,功能非常强大。这里做一个总结,把曾经使用过的功能进行一个记录。


help 原文如下

concat(varlist) [, format(%fmt) decode maxlength(#) punct(pchars)]
            may not be combined with by.  It concatenates varlist to produce a string variable.  Values of string
            variables are unchanged.  Values of numeric variables are converted to string, as is, or are converted
            using a numeric format under the format(%fmt) option or decoded under the decode option, in which case
            maxlength() may also be used to control the maximum label length used.  By default, variables are added
            end to end: punct(pchars) may be used to specify punctuation, such as a space, punct(" "), or a comma,
            punct(,).


应用示例


clearinp str5 var1 var2ASDS  2.334SDDF  0.434WESF  43.45WSFS  3.455endegen var3=concat(var1 var2) //help egen  ;concat合并变量的命令


代码执行后的效果


0 0
原创粉丝点击