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

Posted on 2006-03-30
Last Modified: 2013-11-13

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.

Question by:anshuma
    1 Comment
    LVL 4

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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    seriesUp challenge 7 79
    maxMirror challenge 10 67
    pairs challenge 5 28
    Installed softare without GUID 6 16
    Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
    This article will show, step by step, how to integrate R code into a R Sweave document
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now