楼主: longtom
12014 23

[面板数据求助] stata中相同数据输出不同结果 [推广有奖]

11
longtom 在职认证  发表于 2014-3-13 20:04:45
ywh19860616 发表于 2014-3-11 22:20
也可以试试
FLOATTOLONG: Stata module to recast variables from float to long storage type
大神,在吗?

12
ywh19860616 发表于 2014-3-13 20:08:56
longtom 发表于 2014-3-11 22:35
直接用这一句命令就可以了吗?
你可以安装,然后看看里面的帮助,这个命令就是可以把float储存的
转为long型,这样运算就不会出错。

或者比较简单的方法就是把数据的数量级放小吧,比如都先除以1000,
只要不超过9位数,运算就不会出错。
一份耕耘,一份收获。

13
longtom 在职认证  发表于 2014-3-13 20:17:13
ywh19860616 发表于 2014-3-13 20:08
你可以安装,然后看看里面的帮助,这个命令就是可以把float储存的
转为long型,这样运算就不会出错。

...
我刚才试了一下,我把数据都转化了一下,还是不行,结果还是每次都不一样,我可以加一下您的QQ吗?我的QQ号是377094856

14
longtom 在职认证  发表于 2014-3-13 20:29:34
ywh19860616 发表于 2014-3-13 20:08
你可以安装,然后看看里面的帮助,这个命令就是可以把float储存的
转为long型,这样运算就不会出错。

...
您的意思是时间设置是对的是吗?

15
ywh19860616 发表于 2014-3-13 21:00:05
longtom 发表于 2014-3-11 17:10
有超过9位的啊,您说的是这个原因导致每次结果不一样?
以半年为单位吗?
  1. gen new=date(quarter,"YMD",2012)
  2. gen new1=hofd(new)
  3. format new1  %th
复制代码
一份耕耘,一份收获。

16
longtom 在职认证  发表于 2014-3-13 22:02:38
ywh19860616 发表于 2014-3-13 21:00
以半年为单位吗?
也不是以半年,是季度数据,但是3月份和9月份的数据不多。。。3月份的表示第一季度季报,6月份的表示半年报,9月份的表示第三季度季报,12月份的表示年报,请问这样时间应该怎么设置

17
ywh19860616 发表于 2014-3-13 22:49:52
longtom 发表于 2014-3-13 22:02
也不是以半年,是季度数据,但是3月份和9月份的数据不多。。。3月份的表示第一季度季报,6月份的表示半年 ...
如果是季度数据,请用
  1. gen new=date(quarter,"YMD",2012)

  2. gen new1=qofd(new)

  3. format new1  %tq
复制代码
一份耕耘,一份收获。

18
longtom 在职认证  发表于 2014-3-14 08:52:19
ywh19860616 发表于 2014-3-13 22:49
如果是季度数据,请用
2012是什么意思?

19
ywh19860616 发表于 2014-3-14 10:34:32
longtom 发表于 2014-3-14 08:52
2012是什么意思?
Working with two-digit years

    Consider translating the string 01-12-06 14:22, which is to be interpreted as 01dec2006 14:22:00.  The translation functions provide two
    ways of doing this.

    The first is to specify the assumed prefix in the mask.  The string 01-12-06 14:22 can be read by specifying the mask "DM20Yhm".  If we
    instead wanted to interpret the year as 1906, we would specify the mask "DM19Yhm".  We could even interpret the year as 1806 by specifying
    "DM18Yhm".

    What if our data include 01-12-06 14:22 and include 15-06-98 11:01?  We want to interpret the first year as being in 2006 and the second
    year as being in 1998.  That is the purpose of the optional argument topyear:

            clock(string, mask [, topyear])

    When you specify topyear, you are stating that when years in string are two digits, the full year is to be obtained by finding the largest
    year that does not exceed topyear.  Thus you could code

        . generate double timestamp = clock(timestr, "DMYhm", 2020)

    The two-digit year 06 would be interpreted as 2006 because 2006 does not exceed 2020.  The two-digit year 98 would be interpreted as 1998
    because 2098 does exceed 2020.
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
Sunknownay + 3 + 3 + 3 热心帮助其他会员

总评分: 学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

一份耕耘,一份收获。

20
longtom 在职认证  发表于 2014-3-14 10:38:39
ywh19860616 发表于 2014-3-14 10:34
Working with two-digit years

    Consider translating the string 01-12-06 14:22, which is to b ...
您别老跟我整英文啊。。。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-21 14:59