|
Merge |
Top Previous Next |
|
When writing to a spreadsheet one can control data handling and set matching using the Merge command line parameter. When 'Merge' is active the only data that will be written to the spreadsheet are those data for which the set element names match row and column labels that are in the spreadsheet already. Also under Merge spreadsheet cells for which there is no matching row/column pair will not be changed. Also element ordering is explicitly specified overriding the default that would occur as controlled by the GAMS element ordering rules and the unique element list as discussed in the Rules for Item Capitalization and Ordering chapter. Example: Suppose I have a range in a spreadsheet that appears as in the sheet2 page of the workbook gdxxrwss.xls with exactly the same contents in the range i1:n4.
and use the commands (gdxxrwskipempty.gms)
$call"Gdxxrw GDXse.gdx o=gdxxrwss.xls par=moded4 Rng=sheet2!b1:g4 rdim=2 cdim=1 merge" $call "Gdxxrw GDXse.gdx o=gdxxrwss.xls par=moded4 Rng=sheet2!b8 rdim=2 cdim=1"
then the resultant spreadsheet looks like
where the portion in rows b8-f12 is what happens without the merge and the part in rows 1-4 is what happened with it. Note that the column and row orders vary and the san francisco chicago row is missing since it is not mentioned in the labels before the merge operation and the horse column is present with it's data left alone. Notes:
|