Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8097529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:47:29+00:00 2026-06-05T21:47:29+00:00

This is somewhat complex (well to me at least). Here is what I have

  • 0

This is somewhat complex (well to me at least).

Here is what I have to do:
Say that I have the following dataset:

date    price   volume
02-Sep  40  100
03-Sep  45  200
04-Sep  46  150
05-Sep  43  300

Say that I have a breakpoint where I wish to create an interval in my dataset. For instance, let my breakpoint = 200 volume transaction.

What I want is to create an ID column and record an ID variable =1,2,3,… for every breakpoint = 200. When you sum all the volume per ID, the value must be constant across all ID variables.

So using my example above, my final dataset should look like the following:

date    price   volume  id
02-Sep  40  100 1
03-Sep  45  100 1
03-Sep  45  100 2
04-Sep  46  100 2
04-Sep  46  50  3
05-Sep  43  150 3
05-Sep  43  150 4 

(last row can miss some value but that is fine. I will kick out the last id)

As you can see, I had to “decompose” some rows (like the second row for instance, I break the 200 into two 100 volume) in order to have constant value of the sum, 200, of volume across all ID.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:47:31+00:00Added an answer on June 5, 2026 at 9:47 pm

    Looks like you’re doing volume bucketing for a flow toxicity VPIN calculation. I think this works:

    %let bucketsize = 200;
    
    data buckets(drop=bucket volume rename=(vol=volume));
        set tmp;
        retain bucket &bucketsize id 1;
    
        do until(volume=0);
            vol=min(volume,bucket);
            output;
            volume=volume-vol;
            bucket=bucket-vol;
            if bucket=0 then do;
                bucket=&bucketsize;
                id=id+1;
            end;
        end;
    run;
    

    I tested this with your dataset and it looks right, but I would check carefully several cases to confirm that it works right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several UIViews that have somewhat complex shapes that I have drawn via
Currently I have a service that downloads about 500 records of somewhat complex data,
I have a somewhat complex SQL query that is pulling from a table of
I have a somewhat complex kernel with the following stats: ptxas info : Compiling
I have a messages table that is structured somewhat like this: from | to
Is it possible to have nested set capabilities in this somewhat custom setup? Consider
I have a somewhat complex custom user control, created in C# .NET, which is
Say I have a class, something like the following; class MyClass { public: MyClass();
I have a fairly complex business application written in ASP.NET that is deployed on
This is somewhat of a complex question. I've been trying to implement a system

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.