[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Numbering records with same client number - SAS

Posted on 2013-12-10
1
Medium Priority
?
406 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 2000 total points
ID: 39709629
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

872 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