Solved

Numbering records with same client number - SAS

Posted on 2013-12-10
1
394 Views
Last Modified: 2013-12-10
Experts,

I have an Excel file that has a client_number and start_date end_date residual_start residual_end.

I would like to number the records if they have the same client_number so I can do an edit on the dates to ensure there is no overlapping.

Can someone tell me how to number the records in SAS?  I woule like to program to get the number which is currently in record_number.

See attached example.
Numbering-Sample.xlsx
0
Comment
Question by:morinia
1 Comment
 
LVL 9

Accepted Solution

by:
bradanelson earned 500 total points
Comment Utility
Import the data into a SAS Dataset. Let's call it 'Client_data'.

Sort the data by Client.
PROC SORT DATA=Client_data; BY Client; RUN;

Add the Record_Number column.
DATA Client_data;
    SET Client_data;
    BY Client;

    IF FIRST.Client THEN Record_Number=1;
    ELSE Record_Number+1;

    RETAIN Record_Number;
RUN;
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Top 100 6 103
Folder Replication 4 45
MySQL 11 66
Has anyone used domo? 1 37
This article describes some very basic things about SQL Server filegroups.
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

10 Experts available now in Live!

Get 1:1 Help Now