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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 6 replies
  • 538 views
  • 0 likes
  • 3 in conversation