BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ambadi007
Quartz | Level 8

Hi Team,

I have 2 datasets First dataset name is Part1 and other is Part2..

in Part1 have some subjects and information and PArt2 has some other Subjects information

 

Now i need to set these 2 datasets using subject, and the condition is if Part1 and Part2 have same subjects then I need to display only the information from Part1 dataset while setting or merging 

 

Could you please help me on these 

1 ACCEPTED SOLUTION

Accepted Solutions
japelin
Rhodochrosite | Level 12

Like this?
I'm hoping you can provide some data.

 

data part1;
  input subjid info1 $;
datalines;
1 abc
2 def
4 ghi
5 jkl
8 mno
;
run;

data part2;
  input subjid info2 $;
datalines;
2 pqr
4 stu
6 vwx
7 yz_
;
run;

data want;
  set part1 part2;
  by subjid;
  if first.subjid;
run;

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Can you provode some sample data?

ambadi007
Quartz | Level 8
parta; prtb
101 102
102 101
103 103

here the parta is the main dataset.. if i have parta and part b same subject (eg-103) i need to display only parta subjects information since this the initial data that is collected

japelin
Rhodochrosite | Level 12

Is it set or merge that needs to be done?

ambadi007
Quartz | Level 8
it would be good if we can set the datasets
japelin
Rhodochrosite | Level 12

Like this?
I'm hoping you can provide some data.

 

data part1;
  input subjid info1 $;
datalines;
1 abc
2 def
4 ghi
5 jkl
8 mno
;
run;

data part2;
  input subjid info2 $;
datalines;
2 pqr
4 stu
6 vwx
7 yz_
;
run;

data want;
  set part1 part2;
  by subjid;
  if first.subjid;
run;
ambadi007
Quartz | Level 8
thanks it worked for me

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1388 views
  • 0 likes
  • 3 in conversation