Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: ***SPAM*** AW: ***SPAM*** st: AW: parsing problem


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: ***SPAM*** AW: ***SPAM*** st: AW: parsing problem
Date   Thu, 7 Jan 2010 18:32:16 +0100

<> 

I cannot see a question so far. If you want to extract the day from your
strings:


*************
clear
input str18 date
20jan2007
16June06
06sept1985
21june04
4july90
9jan1999
6aug99
19august2003
end

gen int day=day(date(date, "DMY", 2010))

li, noo
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Federico
Belotti
Gesendet: Donnerstag, 7. Januar 2010 18:23
An: [email protected]
Betreff: Re: ***SPAM*** AW: ***SPAM*** st: AW: parsing problem

thanks very much for your help!

I've another question about mata. I'm working with the regexm() function 
in mata.
My question is the following code. Try directly the code...

clear
input str18 date
20jan2007
16June06
06sept1985
21june04
4july90
9jan1999
6aug99
19august2003
end

*** -regexs()- function works perfectly with stata
gen day = regexs(0) if regexm(date, "^[0-9]+")
list day

tomata

capture mata: mata drop example()
mata

real matrix example(var)
{
/// -regexm()- function seems to work with vectors

one = regexm(var, "^[0-9]+")
one

two = J(8, 1, "")
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index