Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Hijri dates

    Hi statalist. I have a basic question: Does the stata also support the hijri dates? I work with time series data and my dates are monthly. I entered the following codes and did not make any errors until I entered itsa command and gave the invalid syntax message. Whereas when I run these codes in stata default date it works correctly.Can anyone answer me?

    [gen year = int(dateid/100)]
    [gen month = mod(dateid, 100)]
    [gen mdate = mofd(mdy(month, 1,year))]
    [format mdate %tm][list, noobs clean]

    CROSSID dateid Perfor~e year month mdate
    1 139101 1 1391 1 1391m1
    1 139102 .89083 1391 2 1391m2
    1 139103 .67241 1391 3 1391m3
    1 139104 .96226 1391 4 1391m4
    1 139105 .93791 1391 5 1391m5
    1 139106 .70067 1391 6 1391m6
    1 139107 .87219 1391 7 1391m7
    1 139108 .58491 1391 8 1391m8
    1 139109 .83638 1391 9 1391m9
    1 139110 .66353 1391 10 1391m10
    1 139111 1 1391 11 1391m11
    1 139112 .95982 1391 12 1391m12
    1 139201 1 1392 1 1392m1
    1 139202 1 1392 2 1392m2
    1 139203 1 1392 3 1392m3
    1 139204 1 1392 4 1392m4
    1 139205 .68553 1392 5 1392m5
    1 139206 .96768 1392 6 1392m6
    1 139207 .83967 1392 7 1392m7
    1 139208 .75885 1392 8 1392m8
    1 139209 1 1392 9 1392m9
    1 139210 1 1392 10 1392m10
    1 139211 .68645 1392 11 1392m11
    1 139212 1 1392 12 1392m12
    1 139301 .67857 1393 1 1393m1
    1 139302 1 1393 2 1393m2
    1 139303 1 1393 3 1393m3
    1 139304 .84861 1393 4 1393m4
    1 139305 .9611 1393 5 1393m5
    1 139306 .91349 1393 6 1393m6
    1 139307 .89032 1393 7 1393m7
    1 139308 .66038 1393 8 1393m8
    1 139309 .62244 1393 9 1393m9
    1 139310 1 1393 10 1393m10
    1 139311 1 1393 11 1393m11
    1 139312 .99205 1393 12 1393m12
    1 139401 .87226 1394 1 1394m1
    1 139402 .7449 1394 2 1394m2
    1 139403 1 1394 3 1394m3
    1 139404 .74214 1394 4 1394m4
    1 139405 .98742 1394 5 1394m5
    1 139406 1 1394 6 1394m6
    1 139407 .96351 1394 7 1394m7
    1 139408 .92451 1394 8 1394m8
    1 139409 .69182 1394 9 1394m9
    1 139410 .83036 1394 10 1394m10
    1 139411 .9626 1394 11 1394m11
    1 139412 .74138 1394 12 1394m12

    [di ym(1393, 02)]
    -6803

    [tsset CROSSID mdate, monthly]
    panel variable: CROSSID (strongly balanced)
    time variable: mdate, 1391m1 to 1394m12
    delta: 1 month

    [itsa Performance, sing treat(1) trp(-6803)]
    invalid syntax
    r(198);
    Many thanks
    Parastou Amirifar

  • #2
    As far as Stata is concerned you have monthly dates. It's not aware that they are anything unusual, because they aren't.

    My guess is that the problem is quite different.

    itsa (Stata Journal) is a community-contributed program; I would email the author directly for support.

    FWIW, this would also work with your data using numdate (SSC):

    Code:
    numdate month mdate = dateid, pattern(YM)
    That formats on the fly too.
    Last edited by Nick Cox; 03 Oct 2018, 13:34.

    Comment


    • #3
      Thanks Nick for your reply. I ran the code but did not work. The same previous error.
      P.A

      Comment


      • #4
        Indeed. I was just showing you a different way to get the same dates. Otherwise the same syntax with itsa will produce the same problem.

        Comment

        Working...
        X