BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12
How to convert the following merge step into joins. I just given the structure of the merge and in similar fashion I need to achieve the same in Joins.

Data merge;
If a(in=x) b(in=y);
By id;
If x and y;
Then;
Do;
F=7;
End;
If x;
Then;
Do;
F=3;
End;
If y;
Then;
Do;
F=9;
End;
Run;

1 REPLY 1
ballardw
Super User

@Babloo wrote:
How to convert the following merge step into joins. I just given the structure of the merge and in similar fashion I need to achieve the same in Joins.

Data merge;
If a(in=x) b(in=y);
By id;
If x and y;
Then;
Do;
F=7;
End;
If x;
Then;
Do;
F=3;
End;
If y;
Then;
Do;
F=9;
End;
Run;


Because of the way that SAS treats same-named variables in different data sets without a complete example for data in all data sets involved it is not possible to determine even if a similar join is possible. Since you do not actually show a MERGE statement (or SET or other statement that actually indicates source data sets) in your example it is even harder. You example code will throw multiple errors as is.

 

Plus, post code in code box opened with the forum's {I} menu icon so formatting such as indents are preserved.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 533 views
  • 0 likes
  • 2 in conversation