WilDsCOP
 
> However, i have some questions about this : The commands
> 
> . gen month = substr(date, 3, 2)
> type mismatch
> r(109);
> . gen year = substr(date, 6, 4)
> type mismatch
> r(109);
> 
> issues some sort of error. Why? I use Stata version 7.0 Also 
> i'm curious 
> about what does these commands are supposed to do ?
These commands should work if -date- is a string variable. Presumably 
-date- is a numeric variable in your data. 
-substr()- extracts a substring, as documented at [R] functions 
or on-line help for -functions-. 
 
> Anyway, thanks to Toyoto Iwata again (who actually wrote me 
> the whole code) 
> for directing me to the command
> . egen quarter = group(month)
> This does the whole thing (what does this command actually 
> do?). I solved 
> my problem (For future reference, i paste them below of this e-mail).
What -egen, group()- does is documented at [R] egen and 
in the help for -egen-. 
Nick 
[email protected] 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/