• How to repeat each row n times, where n is value in row ?

    From Ruud Steltenpool@21:1/5 to All on Mon Apr 12 05:14:13 2021
    In every row I have a Key, IndexXwithinKey, prop1, prop2, prop3, repetitionsNeeded

    For every Key the repetitionsNeeded is the same, so for that Key the number of rows should go from Max(IndexXwithinKey) to times repetitionsNeeded that.

    What's the easiest way?

    And the most efficient?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich Ulrich@21:1/5 to google@steltenpower.com on Mon Apr 12 16:35:42 2021
    On Mon, 12 Apr 2021 05:14:13 -0700 (PDT), Ruud Steltenpool <google@steltenpower.com> wrote:

    In every row I have a Key, IndexXwithinKey, prop1, prop2, prop3, repetitionsNeeded

    For every Key the repetitionsNeeded is the same, so for that Key the number of rows should go from Max(IndexXwithinKey) to times repetitionsNeeded that.

    What's the easiest way?

    And the most efficient?

    I /think/ you are trying to create dummy records.

    If the Maxrep in every record is a fixed value, you could
    write a loop with the fixed value instead of the variable.
    More generally -

    For a record with Keyv, Lastseen, [some varlist], Maxrep -

    Loop LineNo= Lastseen to Maxrep.
    +xsave outfile= * /vars= Keyv to Maxrep, LineNo.
    end loop.
    exe.

    Xsave does not count as a procedure, so you want to have
    either the exe line or some procedure. I would probably be
    interested in a FREQ on Lastseen.

    There might be faster, easier, or more efficient ways to get
    to whatever analysis or listing you are interested in, but this
    is a quick solution to what I think you have asked.


    --
    Rich Ulrich

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)