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]
Re: st: Combining two data variables (month and year)
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Combining two data variables (month and year)
Date
Tue, 6 Aug 2013 17:36:27 +0100
No; this isn't crazy, but it's usually a bad idea.
Regardless of whether you actually have a day variable -- you could
fudge that by using 1 or 15 instead -- you will end with daily dates
and lots of gaps. That's awkward for almost everything that might
follow.
If you have monthly dates, you want monthly dates and should use -ym()-.
Nick
[email protected]
On 6 August 2013 17:31, Najib Mozahem <[email protected]> wrote:
> if I understand correctly, you have a month_variable and a year_variable and want one date variable to contain both. I used the gen myvar = mdy(month_var, day_var, year_var) command for that.
>
> Najib
>
> On Aug 6, 2013, at 7:01 PM, MCar wrote:
>
>> Dear Statalist users:
>>
>> I need to combine two numeric variables into one variable. The first
>> variable is the month and the second variable is the year.
>>
>> Does anybody know how to do this?
>>
>> Thank you.
>>
>>
>>
>> --
>> View this message in context: http://statalist.1588530.n2.nabble.com/Combining-two-data-variables-month-and-year-tp7580405.html
>> Sent from the Statalist mailing list archive at Nabble.com.
>> *
>> * 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/
>
>
> *
> * 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/
*
* 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/