Any SAS programmer to help

Posted on 2006-03-28
Last Modified: 2010-04-17
I have a set of 50 observations. Once I read them they are read into the data set. The main variable is say TreatmentTime

Apart from that I also want to create a variable tempIndex which is say 1 for observation 1 , 2 for observation 2 and so on. So that I can use tempindex for other calculations. How do I do that

Question by:anshuma
    LVL 4

    Accepted Solution

    SAS uses the temporary variable _N_ as a counter.  To save this as a permament variable, just assign it.

    DATA NewDataSet; SET YourDataSet;
    Tempindex = _N_;


    Author Comment


    I am just getting started with SAS. I hope you will try to help me in future also.

    sincere regards

    LVL 4

    Expert Comment

    My pleasure.  I like SAS a lot and have been using it for many years.

    -- tobydavid

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Mobile App Development with PhoneGap

    PhoneGap can help you leverage your already existing HTML5, JavaScript, and CSS skills in order to create and deploy cross-platform mobile apps.This program comprehensively covers HTML5 mobile app development from top to bottom.

    Suggested Solutions

    Title # Comments Views Activity
    static class 3 44
    twoTwo  challenge 35 71
    linearIn  challenge 23 54
    wordmultiple challenge 12 63
    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    This is an explanation of a simple data model to help parse a JSON feed
    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…

    737 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

    22 Experts available now in Live!

    Get 1:1 Help Now