SAS Programming - Using the output of one procedure as input to other


If I have n observaions from y1 to yn  and I want to calculate p=100(j-0.5)/n

where j=1....n . In SAS terms _N_

now this n is the count of all observations. How do I get  that n. I can use proc means to get that. But How can I store the output(s) of that procedure into different variables which can be used in further calculations.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SAS has a very unique way of dealing with this.

Say you have a SAS data set AA.  Then you run proc means to get summary statistics and save them in a dataset MEANOUT.  

Then to create a new data set (or rewrite AA) so that the summary statistics are available with each observation , use the following DATA step:

Data BB; Set AA;
if _N_ = 1 then Set MEANOUT;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Theory

From novice to tech pro — start learning today.