1. AJ R
  2. savReaderWriter

Source

savReaderWriter / savReaderWriter / doc_tests / test_SavHeaderReader_report1.txt

##############################################################################
## Print a report of the header information
##############################################################################

>>> import sys
>>> sys.stdout.write('<skipline> '); from savReaderWriter import * # doctest: +ELLIPSIS
<skipline> ...

>>> savFileName = "../savReaderWriter/test_data/spssio_test.sav"
>>> with SavHeaderReader(savFileName) as spssDict: # doctest: +ELLIPSIS
...     print(unicode(spssDict))
...     wholeDict = spssDict.dataDictionary()
#ALIGNMENTS
AGE3 -- right
DATE_ -- left
weightVar -- right
aShortStringVar -- left
aLongStringVar -- left
AvgIncome -- right
MaxIncome -- right
SEX -- right
V1 -- right
V2 -- right
V3 -- right
Region -- left
QUARTER_ -- right
Income1 -- right
Income2 -- right
Income3 -- center
Age -- left
ID -- left
YEAR_ -- right
MONTH_ -- right
someDate -- right
AGE2 -- right
#CASEWEIGHTVAR
weightVar
#COLUMNWIDTHS
AGE3 -- 10
DATE_ -- 10
weightVar -- 11
aShortStringVar -- 17
aLongStringVar -- 26
AvgIncome -- 11
MaxIncome -- 11
SEX -- 10
V1 -- 10
V2 -- 10
V3 -- 10
Region -- 10
QUARTER_ -- 10
Income1 -- 14
Income2 -- 14
Income3 -- 15
Age -- 10
ID -- 10
YEAR_ -- 10
MONTH_ -- 8
someDate -- 13
AGE2 -- 10
#FILEATTRIBUTES
$VariableView2[13] -- @DerivedFrom
$VariableView2[10] -- measure
$VariableView2[11] -- role
$VariableView2[01] -- name
VersionNumber -- 1
$VariableView2[03] -- width
$VariableView2[09] -- alignment
$VariableView2[02] -- type
$VariableView2[08] -- columns
$VariableView2[05] -- label
$VariableView2[14] -- @Notes
$VariableView2[04] -- decimals
$VariableView2[07] -- missing
$VariableView2[12] -- @Formula
$VariableView2[06] -- values
#FILELABEL
This is a file label
#FORMATS
AGE3 -- F8.2
DATE_ -- A8
weightVar -- F8.2
aShortStringVar -- A1
aLongStringVar -- A100
AvgIncome -- F8.2
MaxIncome -- F8.2
SEX -- F8.2
V1 -- F8.2
V2 -- F8.2
V3 -- F8.2
Region -- F8.2
QUARTER_ -- F1
Income1 -- F8.2
Income2 -- F8.2
Income3 -- F8.2
Age -- F3
ID -- N6
YEAR_ -- F8
MONTH_ -- F2
someDate -- ADATE40
AGE2 -- F8.2
#MEASURELEVELS
AGE3 -- ratio
DATE_ -- nominal
weightVar -- nominal
aShortStringVar -- nominal
aLongStringVar -- nominal
AvgIncome -- ratio
MaxIncome -- ratio
SEX -- nominal
V1 -- nominal
V2 -- nominal
V3 -- nominal
Region -- nominal
QUARTER_ -- ordinal
Income1 -- ratio
Income2 -- ratio
Income3 -- ratio
Age -- ratio
ID -- nominal
YEAR_ -- ordinal
MONTH_ -- ordinal
someDate -- ratio
AGE2 -- ratio
#MISSINGVALUES
aShortStringVar: values -- x, y
Income1: lower -- -1.797...e+308
Income1: upper -- -1.0
Income2: lower -- -1.797...e+308
Income2: upper -- -1.0
Income2: value -- 999.0
Income3: values -- 999.0, 888.0, 777.0
Age: lower -- 0.0
Age: upper -- 18.0
#MULTRESPDEFS
V: countedValue -- 1
V: label -- 
V: setType -- D
V: varNames -- v1, v2, v3
ages: label -- the ages
ages: setType -- C
ages: varNames -- age, age2, age3
incomes: label -- three kinds of income
incomes: setType -- C
incomes: varNames -- income1, income2, income3, age, age2, age3
#VALUELABELS
Age: 27.0 -- 27 y.o. 
Age: 34.0 -- 34 y.o.
Age: 50.0 -- 50 y.o.
aShortStringVar: x -- someValue label
#VARATTRIBUTES
AvgIncome: DerivedFrom[1] -- Income1
AvgIncome: DerivedFrom[2] -- Income2
AvgIncome: DerivedFrom[3] -- Income3
AvgIncome: Formula -- mean(Income1, Income2, Income3)
MaxIncome: DerivedFrom[1] -- Income1
MaxIncome: DerivedFrom[2] -- Income2
MaxIncome: DerivedFrom[3] -- Income3
MaxIncome: Formula -- max(Income1, Income2, Income3)
#VARLABELS
DATE_ -- Date.  Format:  "MMM YYYY"              
aShortStringVar -- Some mysterious short stringVar
aLongStringVar -- Some mysterious long stringVar
Region -- What region do you live
QUARTER_ -- QUARTER, period 4
Age -- How old are you?
YEAR_ -- YEAR, not periodic
MONTH_ -- MONTH, period 12
#VARNAMES
ID
Age
Region
Income1
Income2
Income3
AvgIncome
MaxIncome
AGE2
AGE3
SEX
V1
V2
V3
someDate
aShortStringVar
aLongStringVar
weightVar
YEAR_
QUARTER_
MONTH_
DATE_
#VARROLES
AGE3 -- input
DATE_ -- input
weightVar -- input
aShortStringVar -- input
aLongStringVar -- input
AvgIncome -- input
MaxIncome -- input
SEX -- input
V1 -- input
V2 -- input
V3 -- input
Region -- partition
QUARTER_ -- input
Income1 -- target
Income2 -- target
Income3 -- target
Age -- input
ID -- input
YEAR_ -- input
MONTH_ -- input
someDate -- input
AGE2 -- input
#VARSETS
#VARTYPES
AGE3 -- 0
DATE_ -- 8
weightVar -- 0
aShortStringVar -- 1
aLongStringVar -- 100
AvgIncome -- 0
MaxIncome -- 0
SEX -- 0
V1 -- 0
V2 -- 0
V3 -- 0
Region -- 0
QUARTER_ -- 0
Income1 -- 0
Income2 -- 0
Income3 -- 0
Age -- 0
ID -- 0
YEAR_ -- 0
MONTH_ -- 0
someDate -- 0
AGE2 -- 0