Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6346191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:58:16+00:00 2026-05-24T20:58:16+00:00

my data set has two variables ID and diagnosis . I am trying to

  • 0

my data set has two variables ID and diagnosis. I am trying to assign row numbers in my dataset based on ID and diagnosis.

the code that I used was;

proc sort data = temp;
by ID diagnosis;
run;

proc rank data = temp out  = temp1;
by id;
var diagnosis;
ranks = diag_rank;
run;

Its giving mr error: the variable diagnosis in list does not match the type

I know my diagnosis has both text and numric values. Is there a way to fix this. Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:58:17+00:00Added an answer on May 24, 2026 at 8:58 pm

    If you are just looking for a unique row number, then the following should work.

    data temp;
       set temp;
       retain row_number 0;
       row_number + 1;
    run;
    

    If you need a conditional row number based on ID and diagnosis, then try:

    data temp;
       set temp;
       by ID diagnosis;
       retain row_number;
       if first.ID then do;
          row_number = 0;
       end;
       row_number + 1;
    run;
    

    If, on the other hand, there is some explicit order of ranking that you wish to impose on the DIAGNOSIS variable other than the sorted character values, then you could use a user-defined format to map each of the character values to a number, then use this format to create a row_number variable in a data step, like the following.

    proc format;
       value $diag_row
       "67"   = 2
       "A234" = 4
       "B45"  = 3
       "V456" = 1
       other  = 999
       ;
    run;
    
    data temp;
       set temp;
       format row_number 8.0;
       row_number = put(diagnosis,$diag_row.);
    run;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to ship some Java code that has an associated set of data.
I have a data set that has two tab delimited columns that I plot
I have a dataset that has two tables in it. I want to do
I have a data object (let's say it's called 'Entry') that has a set
I have the following problem. I have a data set that has the beginning
I have a data set with over 50,000 geocoded points (lat-long). Each point has
I have a data frame where one particular column has a set of specific
using a dataset,each row has a method called hasVersion() which implies to me it
I have a web service which has a generic function that returns a dataset
I have a WebForms page that has two DropDownList controls on it that both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.