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

st: changing format

From   Nishant Dass <>
To   STATA Help <>
Subject   st: changing format
Date   Thu, 16 Oct 2008 12:16:54 -0700 (PDT)


I am using Stata 10.0 for Windows and I have a small question about the "format" of variables:

I have several date variables that appear as string variables in my Stata dataset (reported as "31JAN2008", for instance):

              storage  display     value
variable name   type   format      label      variable label
maturitydate    str9   %9s                    MaturityDate
offerdate       str9   %9s                    OfferDate

I need to find the duration between these two dates so I am trying to change them to a date format as follows:

. format maturitydate offerdate %td

But I get the following error: 

"string %fmt required for string variables"

Could someone tell how can I change string variables to dates? 

Thank you!


*   For searches and help try:

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