User Tools

Site Tools


howtos:workwithdata:export_quick_reference

This is an old revision of the document!


Examples of common export calls are provided below.

It is convenient to set up one or more import directory paths up front. For example:

string $exportDir= $home + "/exportData"

csv coordinate format

This code exports a 2-dimensional population TOOL object (by age, by time) to a csv file with age in the rows and time in the columns.

export (refPop[a,ts]; dataFormat=coordinate, fileFormat=text, allCoord=off, delimiter=",", \
			heading=on, file=$exportDir/refPop.csv)

tab delimited text odometer (block) format

This format is useful for migrating data between models in a human-readable format, as opposed to binary tool-format files. Note the use of expForm and decimals parameters to preserve precision.

export (immigration[s,ts1,a]; dataFormat=odometer, fileFormat=text, \
	expForm=on, decimals=6, \
	file=$exportDir/immigration.txt)
!	sex=male
! 	0		1		2	
"1977"	1.049407e+02	1.314661e+02	1.317941e+02
"1978"	9.129648e+01	1.133035e+02	1.212180e+02
"1979"	8.643492e+01	9.573391e+01	9.366822e+01
"1980"	9.673356e+01	9.806976e+01	9.806976e+01

TOOL format

This is an example of exporting to whatIf's native (binary) TOOL file format:

export (customCensusPop[pzce,s,byrs,acc]; format=tool, file=$exportDir/customCensusPop)
howtos/workwithdata/export_quick_reference.1307026576.txt.gz · Last modified: 2011/06/02 14:56 by marcus.williams