Note that there are some explanatory texts on larger screens.

plurals
  1. POMinimum obs from dataset to cover all required levels
    text
    copied!<p>I'm stumped.</p> <p>I want to reduce a really big data-set to fewer observations, but containing all the levels of the original data-set (at most) once. This would be done for testing purposes, so it's in our best interest to come up with final data-set that has least number of obs.</p> <p>So if we take data-set SASHELP.CLASS for example. I would like to find out the first obs (or any non-specific obs really, but i feel it might be easier with first/last obs) that covers each individual levels of the original data-set, <strong>not</strong> all possible (existing, or theoretical) combinations of the required variables.</p> <p>Output would look something like this: (SASHELP.CLASS: all levels by AGE, SEX):</p> <ul> <li>AGE has 6 distinct levels (11-16)</li> <li>SEX has 2 distinct levels ("F", "M")</li> <li>Least number of obs covering those levels theoretically is 6.</li> </ul> <p>So we should end up with:</p> <ul> <li>OBS #1: Affred, "M", 14</li> <li>OBS #2: Alice, "F", 13</li> </ul> <p><em>Barbara, Carol, and Henry will not be output, as both F-M and 13-14 are covered</em></p> <ul> <li>OBS #3: James, "M", 12</li> <li>OBS #4: Janet, "F", 15</li> <li>OBS #5: Joyce, "F", 11</li> <li>OBS #6: Philip, "M", 16</li> </ul> <p><em>end of output</em></p> <p>In this case we went through data sequentially, and we've found minimum number of obs (6) satisfying the requirement, but if the levels get more lengthy (or inter-correlated), and data assorted (supposed we could pre-sort), we might end up with something that is close to minimum, but not quite minimum of longest level among required variables.</p> <p>I would imagine this would require some sort of recursive algorithm to get most efficiently small number of obs to cover the values, but have no clue where to start. Any help will be greatly appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload