An automatic join (or “autojoin”) data
set contains the table names and column links that are required to
join tables automatically in an SQL Query Window session. When tables
that are defined in the automatic join data set are selected together,
the corresponding column links are used to automatically start the
query's WHERE expression. An autojoin data set can be shared by many
users.
The following example illustrates the creation of an
automatic join data set. Select the right arrow next to the
Automatic Join field, and then select
Create
an Automatic Join Data Set from the pop-up menu that
appears.
Select
SAMPLE from the Table Source list to populate the Available Tables list.
Select SAMPLE.EMPINFO and SAMPLE.LEAVE. Select
OK. The
Automatic Join Column Links window
is displayed.
These two tables have
the NAME column in common. Select NAME from both the SAMPLE.EMPINFO
Columns list and the SAMPLE.LEAVE Columns list. Select
OK. If the two tables had any other columns in common,
then you would be able to select these columns as well and store the
column links in the automatic join data set.
Select
Goback to return to the Available Tables list.
Select
Show
Links to display the link that you have created between
the two data sets.
Select
Goback. You can repeat the previous procedure for as many pairs of tables
as you want.
When you are finished
defining column links, select
Save to save
your automatic join data set.
If desired, type an
appropriate label in the
Label field. Select
OK.
Note: For this example, the default
SASUSER.AUTOJOIN data set is used. However, by specifying a different
library or table name, you can save the autojoin data set to a different
location.
Select
Goback to return to the
Preference Settings for Profile window. Select
Save and then
OK to save the changes to the profile. Select
Close to return to the SQL QUERY TABLES window.
When you start the SQL
Query Window, the software looks for the automatic join data set that
is specified in the default profile, whether the automatic join data
set is the default SASUSER.AUTOJOIN or some other data set that you
have specified. If an autojoin data set is not found, then no automatic
joins are performed.
Select
FileClose to end your SQL Query Window session. Select
OK in the dialog box that appears in order to return to the Program
Editor.
Invoke another SQL Query
Window session. Select SAMPLE.EMPINFO and SAMPLE.LEAVE from the Available
Tables list and add them to the Selected Tables list. Select
OK to display the
SQL QUERY COLUMNS window.
Select DIVISION from
the Available Columns list and add it to the Selected Columns list.
Select
ViewWhere Conditions for Subset to display the
WHERE EXPRESSION window.
The WHERE expression
begins with the column link that you specified in your autojoin table.