Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

RE: st: how to store matrix in a data file

From   "rasool.bux" <>
To   "" <>
Subject   RE: st: how to store matrix in a data file
Date   Wed, 24 Oct 2012 09:26:12 +0000

Thank you very much now it is working properly. I have done minor changes in the following lines for my use i.e. for storing sample no and coef of constant.

postfile `memhold' bsamp b_cons `vlist' using `results'
// reset local res to empty
local res "(`i') (_b[_cons])"

Rasool Bux

-----Original Message-----
From: [] On Behalf Of Maarten Buis
Sent: Wednesday, October 24, 2012 12:19 PM
Subject: Re: st: how to store matrix in a data file

On Wed, Oct 24, 2012 at 7:22 AM, rasool.bux wrote:
> Thank you very much for sending me the nice code. But there is a problem in it. This is storing missing values (.) for displacement and gear_ratio column even they are included in the model.
> I have compared the stored results by removing capture from the sw command. I think we have to write full variable names in the varlist vars then it is working fine i.e. displacement instead of displ, gear_ratio instead of gear.

Correct. You have already given one solution: I should not be lazy and type the full variable names.

Another solution that will protect you against lazy people like me is to add the line:

unab vars : `vars'

directly after the line

local vars "c_weight c_weight2 displ gear turn headroom foreign c_price"

This takes the varlist specified in local vars with potentially abbreviated variable names and "unabreviates" all variable names.

Alternatively, some people prefer not to allow variable abbreviation at all, in order to protect themselves against such mistakes. To do so you can type - set varabbrev off- to disallow variable abbreviations in the current session, or -set varabbrev off, permanently- to disallow variable abbreviation for all future sessions (or until you type -set varabbrev on-, when you tried it and found it too annoying.).

Hope this helps,

Maarten L. Buis
Reichpietschufer 50
10785 Berlin
*   For searches and help try:

No virus found in this message.
Checked by AVG -
Version: 2013.0.2741 / Virus Database: 2616/5848 - Release Date: 10/22/12


This e-mail may contain information that is privileged or confidential. If you are not the intended recipient, please delete the e-mail and any attachments and notify us immediately.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index