Download Internationally Developed Data Analysis and Management

Transcript
140
Importing/Exporting Data (IMPEX)
16.9
Examples
Example 1. Selected variables from the input dataset are transferred to the output file along with two
new variables; data are output in free format with values separated by a semicolon; commas will be used
in decimal notation while alphabetic variable values will be enclosed in quotes; variable names and variable
numbers will be included in the output data file.
$RUN IMPEX
$FILES
PRINT
= EXPDAT.LST
DICTIN = OLD.DIC
input Dictionary file
DATAIN = OLD.DAT
input Data file
DATAOUT = EXPORTED.DAT
exported Data file
$SETUP
EXPORTING IDAMS FIXED FORMAT DATA TO FREE FORMAT DATA
EXPORT=(DATA,NAMES,CODES) BADD=MD1 MAXERR=20 OUTVARS=(V1-V20,V33,V45-V50,R105,R122) FORMAT=DELIM WITH=SEMI DECIM=COMMA STRINGS=QUOTE
$RECODE
R105=BRAC(V5,15-25=1,<36=2,<46=3,<56=4,<66=5,<90=6,ELSE=9)
MDCODES R105(9)
NAME R105’GROUPS OF AGE’
IF MDATA(V22) THEN R122=99.9 ELSE R122=V22/3
MDCODES R122(99.9)
NAME R122’NO ARTICLES PER YEAR’
Example 2. DIF format data are imported to IDAMS; column labels and column codes are included in the
input data file, and commas are used in decimal notation.
$RUN IMPEX
$FILES
PRINT
= IMPDAT.LST
DICTIN = IDA.DIC
Dictionary file describing data to be imported
DATAIN = IMPORTED.DAT
Data file to be imported
DICTOUT = IDAFORM.DIC
output Dictionary file
DATAOUT = IDAFORM.DAT
output Data file
$SETUP
IMPORTING DIF FORMAT DATA TO IDAMS FIXED FORMAT DATA
IMPORT=(DATA,NAMES,CODES) BADD=MD1 MAXERR=20 FORMAT=DIF DECIM=COMMA
Example 3. A set of rectangular matrices created by the TABLES program is exported; values will be
separated by a semicolon and commas will be used in decimal notation; column and row labels and codes
will be included in the output matrix file; input matrices are printed.
$RUN IMPEX
$FILES
PRINT
= EXPMAT.LST
DATAIN = TABLES.MAT
file with rectangular matrices
DATAOUT = EXPORTED.MAT
file with exported matrices
$SETUP
EXPORTING IDAMS RECTANGULAR FIXED FORMAT MATRICES TO FREE FORMAT MATRICES
EXPORT=(MATRIX,NAMES,CODES) PRINT=DATA FORMAT=DELIM WITH=SEMI DECIM=COMMA STRINGS=QUOTE
Example 4. Importing a square matrix containing distance measures for 10 objects numbered from 1 to
10; only integer values are included and are separated by the % sign; column/row codes as well as vectors
of means and standard deviations are included in the matrix file.