Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

25 views
Skip to first unread message

Ruud Steltenpool

unread,
Apr 12, 2021, 8:14:15 AM4/12/21
to
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?

Rich Ulrich

unread,
Apr 12, 2021, 4:35:50 PM4/12/21
to
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
0 new messages