BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have 2 tables
Thanks!
3 REPLIES 3
Doc_Duke
Rhodochrosite | Level 12
To use a MERGE with a BY statement, the observations are joined on matching values of CD. Since you have none, the example data would have 8 observations. Your "if in1 and in2;" statement is what causes the output dataset to have 0 observations.

To include all rows of T1, change the IF statement to
IF in1;
In this example, your output dataset, e1, would be the same as t1.

To understand this behavior, get rid of the DROP and subsetting IF, and add a KEEP statement for in1 and in2 and then look at the output.

This paper will help
http://support.sas.com/techsup/technote/ts705.pdf
(I just searched support.sas.com for "merge examples".)

Doc Muhlbaier
Duke
deleted_user
Not applicable
Sorry I am kind of new to SAS, but isn't this 'If in1 and in2' statement applicable for assigning the job id to batch id? Why should it affect the MErge?
Doc_Duke
Rhodochrosite | Level 12
&job_id is a macro variable that you haven't defined. To more fully answer your questions, you need to provide a complete example of what you are trying to do and the answers you are looking for. I did answer your question of how to include all rows of T1, but your response indicates that is not the problem you were trying to solve.

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