How to delete observations in SAS
SAS: Make up to the loop and delete observations - arrays, loops, sas
My dataset contains the following variables:
First I want to create a new variable "Ratio" = Sum (Actual) / Sum (Expected). For the first observation, I want this expression to contain all of the values of Actual and Expected. For the second iteration, I want to repeat this expression with just the second observation and on. Then for the third iteration I want to include the third observation and on.
This is an example of the data and formula as it would look in Excel.
Second, the record could be any number of times, so I want the expression to continue until the "ratio" is below a value I manually set. Ideally, the program also includes the creation of a fourth variable with the number of observations that are excluded from the printout. For the first observation it would be "0", the second observation "1", the third observation "2" and so on.
I think that will need an array too? Thanks in advance.
Reply:0 for the answer № 1
They are requesting that code be written for you, English: www.mjfriendship.de/en/index.php?op...37&Itemid=32 That's off-topic (instead of asking for help with the code you wrote ), But you may have an interesting technical question or ask a new one.
What you want to do here is sort your data in reverse if possible. If there is no sorting, you can either add an observation counter:
Or you can use POINT to reverse your order of record, although this is a little slower. This is the basic form of the latter technique. If you can reverse the order, you don't need the do loop or the set options.
From here, you should be able to clear the rest of your question. You will of course have to re-sort using the correct sorting method afterwards.
- Why do we eat cake on birthdays
- How do you leave a narcissistic spouse
- What is an example of emotional health
- Are you from Rawalpindi
- Where do operating system errors come from
- What causes the heartbeat to skip
- Why should everyone learn a little higher math
- How can I remove my tenant
- How can I enjoy this paradoxical life
- Where do women urinate from
- How good is IIM Vizag
- What are the most troublesome websites
- What color goes with the dark gray top
- Why is Tulsi Gabbard a Democrat
- What is the purpose of online advertising
- Which song titles are also whole sentences
- Why are Dyson products expensive
- An IQ of 122 is good
- Why is platinum a precious metal
- Can someone share Salesforce admin certification dumps
- Dentists intentionally damage your teeth
- How do blog posts work on Quora
- Relate your life to movies
- How would you rate Death Stranding