ehi
how can I cancel out my name away from the stata list??
----- Messaggio originale -----
Da: [email protected]
A: "statalist" <[email protected]>
Inviato: Giovedì, 13 agosto 2009 9:50:40 GMT +01:00 Amsterdam/Berlino/Berna/Roma/Stoccolma/Vienna
Oggetto: Re: Re: st: how to change specific string variable into date variable?
Nick, thank you very much!
You always told me something basic I do need to learn. Thank you.
Best regards,
Rose
----- Original Message -----
From: Nick Cox <[email protected]>
To: <[email protected]>
Subject: Re: st: how to change specific string variable into date variable?
Date: 2009-8-13 04:25:26
Martin Weiss suggested a solution which worked fine. Rose's problem was
left unexplained, however, yet the explanation is given directly in the
help for -dates_and_times-.
For functions like -monthly()-,
"The pair of numbers to be translated must be separated by space or
punctuation. No extra characters are allowed."
As Rose's dates are run together, this condition is not satisfied.
g date2=monthly(substr(date, 1, 4) + " " + substr(date, 5, 2),"YM")
would have been a direct solution. Where someone has seen fit to put
year and month together, we insert a space between them.
Nick
[email protected]
Rose <[email protected]>
Something wrong happened when changing the string variable into date
variable.
clear
input country:mylabel /*
*/ str10 date, auto
Argentina "199001"
Argentina "199001"
Argentina "199001"
Argentina "199002"
Argentina "199003"
Argentina "199004"
Argentina "199004"
Argentina "199004"
Argentina "199004"
Argentina "199101"
Argentina "199101"
Argentina "200803"
Argentina "200804"
Argentina "200804"
Brazil "199001"
Brazil "199002"
Brazil "199002"
Brazil "199003"
Brazil "199003"
Brazil "199003"
Brazil "199003"
end
g date2=monthly(date,"YM")
The result showed "21 missing values generated"
Anything wrong? How to correct it ?
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/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/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/statalist/faq
* http://www.ats.ucla.edu/stat/stata/