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?
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;

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.