I would like to stack tables through UNION, but do it by the name of the field, since the tables are basically the same fields, but each table may not have all the fields, and the column order may differ. For instance.
Table 1 Table 2 Table 3 Table 4
Age Age Age Height
Height Height Height Weight
Weight Weight Weight Age
Race Race Gender Gender
--- Gender
For example, the following code may be broken in the following example:
SELECT * FROM TABLE 1
UNION ALL SELECT * FROM TABLE 2
UNION ALL SELECT * FROM TABLE 3
UNION ALL SELECT * FROM TABLE 4
A motivating example is polls with quarterly or annual waves. Sometimes the fields drop out, while others are added every year. I would now like to create a process that does not require excessive attention when displaying past changes or breaks as a result of minor future changes.
, SAS, . SQL, "UNION ALL BY NAME" - ?