Bookmark and Share

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]

AW: st: AW: identify all variables with dates


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: AW: identify all variables with dates
Date   Wed, 3 Mar 2010 10:46:31 +0100

<> 

Everything rides on the question: How many other vars are there floating
around that Stata might mistake for dates, and how do they differ from the
ones you want? The heuristic could be as easy as searching for strings of
length 10:


*************
clear*

inp str10 mydate byte othervar  /* 
*/ str5 otherstring str10 yetanotherdate
"13/12/2007"	01 "hdgs" "13/12/2007"
"14/12/2007"	02 "hdgs" "14/12/2007"
"17/12/2007"	03 "hdgs" "17/12/2007"
"18/12/2007"	04 "hdgs" "18/12/2007"
"19/12/2007"	05 "hdgs" "19/12/2007"
"20/12/2007"	06 "hdgs" "20/12/2007"
"21/12/2007"	07 "hdgs" "21/12/2007"
"27/12/2007"	08 "hdgs" "27/12/2007"
"28/12/2007"	09 "hdgs" "28/12/2007"
"02/01/2008"	10 "hdgs" "02/01/2008"
"03/01/2008"	11 "hdgs" "03/01/2008"
"04/01/2008"	12 "hdgs" "04/01/2008"
"07/01/2008"	13 "hdgs" "07/01/2008"
"08/01/2008"	14 "hdgs" "08/01/2008"
"09/01/2008"	15 "hdgs" "09/01/2008"
end

ds, has(type 10)
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von raoul reulen
Gesendet: Mittwoch, 3. März 2010 10:24
An: [email protected]
Betreff: Re: st: AW: identify all variables with dates

Hi Martin

Thanks for your suggestions. The problem is indeed like you describe.
The potential date variables are stored as strings in the following
format: dd/mm/yyyy. How would I identify such variables? Many thanks
for your help, it is much appreciated.

Raoul
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index