Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: How do I convert a numeric monthly date into 1jan2000 format for use as an argument to the haver command?
From
Aaron Kirkman <[email protected]>
To
[email protected]
Subject
st: How do I convert a numeric monthly date into 1jan2000 format for use as an argument to the haver command?
Date
Mon, 5 Aug 2013 10:32:02 -0500
Statalist,
I have a numeric monthly date stored in a macro, i.e.
loc currentmonth 643
for August 2013. Is there a way to convert this month into the format
01aug2013 for use with the haver command's "twithin" or "tin" option?
Currently, I have this code:
loc monthn 643
loc month `=dofm(`monthn')'
di %td `month'
haver use PCUP using "haver\USECON.dat", twithin(01jan2013,`month') clear
but this returns an r(198) invalid syntax error. If I follow the
documentation and omit the macro:
haver use PCUP using "haver\USECON.dat", twithin(01jan2013,01aug2013) clear
I get the same error. The command works properly if I omit the "twithin" option:
haver use PCUP using "haver\USECON.dat", clear
What is the proper date format for the haver command, and how do I
convert this numeric date into that format?
Thank you,
Aaron Kirkman
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/