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;
'
What should the output be for your example data?
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;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.