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]

RE: st: Stata commands "version" and "saved results"


From   Marco Ercolani <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: Stata commands "version" and "saved results"
Date   Tue, 18 Jan 2011 12:54:32 +0000

Thank you to Nick Cox for pointing me in the right direction.
The answer is simple:

. version 9.2: di c(version)
9.2
. version 9.2: di c(stata_version)
11.1

One can then do whatever one wants with these c(.) codes.

Yours,
 Marco.


Dr Marco G. Ercolani
 Senior Undergraduate Tutor
Department of Economics
University of Birmingham
Edgbaston, B15 2TT
Departmental: www.economics.bham.ac.uk/people/Academic_Staff/ercolanim.shtml
Personal: www.socscistaff.bham.ac.uk/ercolanim/
________________________________________
From: [email protected] [[email protected]] On Behalf Of Nick Cox [[email protected]]
Sent: 18 January 2011 12:06
To: [email protected]
Subject: Re: st: Stata commands "version" and "saved results"

I don't understand your question. As your code illustrates, you can
access items such as c(version) directly, so you are not dependent on
whether any command produces them as saved results. -creturn li- gives
this and other constants. It sounds as if you need c(stata_version).
This is all documented in the manuals: [P] is the best place to look.

(And naturally, the result need not be integer.)

Nick

On Tue, Jan 18, 2011 at 11:53 AM, Marco Ercolani
<[email protected]> wrote:

> I need a command that returns an integer for the version of Stata anyone is using.
> I then want to use this integer to decide what save command to implement,
> along the lines of:
>
> if e(V)>=10: saveold  dataset.dta
> if e(V)<0: save dataset.dta
>
>
> I know that many commands exists to ask Stata what version is running but the
> manuals do not document if any of these commands produce "saved results":
>
> Examples:
>
> . version
> version 11.1
>
> . display c(version)
> 11.1
>
> . about
> Stata/MP 11.1 for Windows (64-bit x86-64)
> Born 04 Nov 2010
> Copyright (C) 2009 StataCorp LP
>
>
>
> This following simple solution does not work because it still saves the data as version 10:
>
> version 9.2: save dataset.dta

*
*   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