[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

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.

1 Solution
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;


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now