Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

AW: st: AW: identify all variables with dates


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von raoul reulen
Gesendet: Mittwoch, 3. März 2010 10:24
An: statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index