BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear,

I would like to know if i can find a way to find the the variables with different vales.  In my data set there are duplicates by 'id' variable vales but other variables values are different. I used proc sort data=one out=two nodupkey;by _all_;run;   With this step one of the duplicate for id=3 removed.  Now I need to know which variables have different values for other subjects. My data set has close to 200 variables. Please suggest. Thank you  

 

 

data one;
input id a $ b $ c $ d e;
datalines;
1 a b c 1 2
1 a b c 1 3
2 b b c 1 2
2 c b c 1 3
3 a b c 1 2
3 a b c 1 2
;

3 REPLIES 3
PGStats
Opal | Level 21

What should the output be for your example data?

PG
knveraraju91
Barite | Level 11

Thank you very much for your time.  

 

My question was, the data set that i am working is subject level data set which should have only one record for 'id'.  In my output there should be only three records. But when i ran 'proc sort data=one out=two nodupkey;by _all_;run; ' i am able to remove only one record which is for id=3.   Now i need to find which variables have different values for id=1 and id=2. In the below example, for id=1, the variable 'e' has different values and for id=2, the variable 'a' and 'e' has different values. So i want to output something like below so i can quickly see which variables have different values

 

output needed

data want;

id     a               e

1                      2,3

2     b,c            2,3

  

 

data one;
input id a $ b $ c $ d e;
datalines;
1 a b c 1 2
1 a b c 1 3
2 b b c 1 2
2 c b c 1 3
3 a b c 1 2
3 a b c 1 2;
Reeza
Super User
Does each ID have only two records each, or can there be multiple records per ID? Is there a limit to how many there can be?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 642 views
  • 0 likes
  • 3 in conversation