Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How do I copy a table loaded earlier in the text script?
My script is loading a table at the begining called Complaints. Later in the script I want to use a copy of that table, rename it and then to do a join with another table.
I'm just not sure how to copy the Complaints table.
Thanks.
Jeff
Jeff,
You can use a Resident load to copy another table that is already loaded into Memory.
Complaints_Copy:
Load *
RESIDENT Complaints;
Remember, that your table loaded with Load * from resident x_table; will have exactly the same column names, and tables will be asociated to each other by all fields. If you really need all table 2'nd time you shoul consider if field names should not use QUALIFY or explicit change column names (as).
regards
Darek
Hi.
If you want to join it you don't have to make a separate copy.
Suppose you want to left join all fields^
left join(sometable)
LOAD
*
Resident Complaints;
I suppose whiteline gave the answer
but if you want create a copy of Complaints
Complaints:
load
field1,
field2,
......
from
......;
..........
.........
//Complaints copy
// rename fields to avoid automatic concatenation or association, synthetic key, etc....
ComplaintsCopy:
load
field1 as field1copy,
field2 as field2copy,
.......
resident
Complaints;
// join
left join (ComplaintsCopy)
load
........
.......
;