Statalist


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

st: Plugins, another strange behavior


From   "Sergiy Radyakin" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Plugins, another strange behavior
Date   Mon, 14 Jan 2008 17:24:25 -0500

Hello Stata users,

the following strange issue was discovered while writing a plugin to
process the dataset currently in Stata's memory. It seems that
casewise deletion of observations with missing values of variables
passed on to the plugin is forced by Stata.

Consider the following example:

       w   r   x     y
  1.   1   1   1   101
  2.   1   1   2   102
  3.   1   1   3   103
  4.   1   1   0     .
  5.   1   1   5   105
  6.   1   1   6   106
  7.   1   1   7   107
  8.   1   1   8   108
  9.   1   1   9   109
 10.   1   1   .   100


Variables x and y each have a missing value, though in different observations.

An extract from the code (Delphi) which illustrates the problem follows:

for i:=SF_in1 to SF_in2 do if SF_ifobs(i)=bTrue then
           SF_Display(PChar('Processing observation: '+IntToStr(i)+'{break}'));

The code loops through all observations from lower "in" value to upper
"in" value and if the observation satisfies the "if" condition it's
index is sent to Stata's output window.

As a result we have:

Processing observation: 1
Processing observation: 2
Processing observation: 3
Processing observation: 5
Processing observation: 6
Processing observation: 7
Processing observation: 8
Processing observation: 9

Where observations 4 (the one with the missing y) and 10 (the one with
the missing x) are not listed. No "if"-condition was specified, and
according to the manual for plugin-developers the function SF_ifobs()
must return "True" for all observations.

Both Stata 9 and Stata 10 show identical behavior in this issue. Is
this supposed to be so? Is it controllable? How can one access x[4]
and y[10] in this example?

Thank you,
    Sergiy Radyakin
    Consultant, DECRG, The World Bank.
*
*   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/



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