Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Querying Stata on what kind of machine it is running

From   Jeph Herrin <>
Subject   Re: st: Querying Stata on what kind of machine it is running
Date   Mon, 28 Aug 2006 07:38:29 -0400

Look up -creturn- and find:

"c(os) returns a string containing "Windows", "Unix", or "MacOSX", depending on
  the operating system that you are using."


Marco Petracco Giudici wrote:
Hello everybody,

I have been searching the manual and the net for a while, but could not find an answer to what should be an "easy" question. I have a Mac laptop and a Windows desktop, both of them with stata installed. I am writing .do files and would like to make them send their output to a certain directory/folder using the "cd" "use" and "save" commands.
However the syntax of the "cd" and other commands is different in Stata for Mac and Stata for Windows (the way of specifying the path is different under the two OSs)
The question then is: is there a way of querying on what machine stata is running in order to execute the command with the appropriate syntax?
In other words, I would like to write a bit of code to do something like

" Discover on which machine stata is running "
" if running on a Mac execute cd command with mac syntax "
" else if running on a winxp machine execute cd command with winxp syntax "

grateful for any help,

best regards,

Marco Petracco Giudici
PhD program in Economics and Organization
University of Venice

___________________________________________________________ Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The Wall Street Journal
* For searches and help try:

*   For searches and help try:

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