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

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: RE: reading a value from a file into a scalar |

From |
Finne Håkon <Hakon.Finne@sintef.no> |

Date |
Thu, 6 Jun 2002 17:55:45 +0200 |

Reply-to |
statalist@hsphsun2.harvard.edu |

Sender |
owner-statalist@hsphsun2.harvard.edu |

Here is an unfinished idea: Unless you are using Stata for Macintosh, -environment name- will return the contents of the operating system's environment variable so named. If you could write the output number of your Maple operation (as a string, I think is better) to the operating system environment, then that's a place where Stata could pick it up. For example, under Windows, the Stata command -!set /p maple=<c:\maple.txt- would make Windows read its maple environment variable from the contents of the file c:\maple.txt . Unfortunately, however, this particular env.var. is only available directly within the shell opened by ! , which closes before you go back to Stata ; so you would have find a way to set a more 'permanent' environment variable either from within Stata or from Maple or from a batch file that contains the maple command and the inv.vir. command and is invoked from Stata. This might be easier under Unix - ?? I hope this helps. Håkon Håkon Finne http://www.sintef.no > -----Original Message----- > From: Chris Wallace [mailto:Chris.Wallace@lshtm.ac.uk] > Sent: 6. juni 2002 16:59 > To: statalist@hsphsun2.harvard.edu > Subject: st: reading a value from a file into a scalar > > > Dear statalisters, > > I am using -ml- to maximize a multiple equation model. One of the > steps in calculating the likelihood involves finding a particular > solution to a quartic. > > I have written a function to do this in maple, and now want > to use this > from within stata. I am hoping to do this by calling maple from stata > > . shell maple < maple_command_file > > and writing the result from maple into a file, then reading that into > stata as I don't believe stata will accept a return value from shell. > Can I assign the contents of a file (which I know will be a single > number) to a scalar? How? > > I'd rather not mess about with reading the single value using > -infile-, > bc then I'd have to -preserve-/-restore- my rather large dataset each > time. > > I know I could also try using -bisect- from within Stata, but suspect > maple would be significantly faster if only I could get the 2 programs > to communicate nicely. My worry with using maple is the errors that > might result from forcing stata and maple to read/write > representations > of numbers to files. > > Thanks for any suggestions, Chris. > > * > * For searches and help try: > * http://www.stata.com/support/faqs/res/findit.html > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**Re: st: reading a value from a file into a scalar** - Next by Date:
**st: estimated forecast variance** - Previous by thread:
**st: RE: Stata programming and the scalar/tempname command** - Next by thread:
**st: estimated forecast variance** - Index(es):

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