11-03-2017 01:36 AM
I have multiple SAS data sets generated from different tables in a single folder. All the SAS datasets have a common column which is the week and along with the week are the variables of those particular tables. Now, I would want to load all these SAS datasets in a single Teradata table with one week column and all the variables from all the other tables into it. A code for this would be really helpful.
Please suggest a way for this.
Thankyou in advance!
11-03-2017 03:50 AM
11-03-2017 05:04 AM
Every table has the same set of weeks. And every table has only one row per week.
|Table A||Table B||Table C|
The above mentioned tables have to be consolidated as below:
|Final Result Set in Teradata Table|
All these SAS Datasets(Variable_1,Variable_2 and so on) are available in a folder. There are around 500 datasets. How to select them all and consolidate and load to a Teradata table as mentioned above.
11-03-2017 05:46 AM
The basic step would look like:
data teradata.target;: merge ds1 ds2 .... dsN ; by week; run;
which will put all variables side-by-side (week will appear only once, of course).
Depending on the name structure of your existing datasets, you will either have the option of using dataset lists (Mergin with Dataset Lists), or you might have to use a macro to insert the list of dataset names in the merge statement.