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: how to store matrix in a data file


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: how to store matrix in a data file
Date   Wed, 24 Oct 2012 09:18:58 +0200

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

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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