Query module

 

Output to STATA

Selecting STATA as the output type will result in the creation of 3 files, as shown below. If ShortCodes are being used an additional QLU (Question Look Up) file is created. The maximum string-length which STATA can accept is 244 characters.

Response Data file

When saving the output in the OUTPUT section, you are prompted to enter the name of the ResponseData STATA file.

The default name is StudyName_YYYYMMDDSTATA.ana

Data Record

(1 per subject)

A space delimited file of fixed length fields as stipulated in StudyName_YYYYMMDDSTATA.dct.

Questions file

The name of the Questions file is derived from the ResponseData filename, replacing .ana with .dct

The default name is StudyName_YYYYMMDDSTATA.dct

Data Type Records

(1 per Question)

Each row defines a field in the ResponseData file, starting with the 7 identification fields which appear as follows:

_column(1)   str15  Trial             %15s   "Study Name"

_column(17)  str8   Site              %8s    "Study Site"

_column(26)  str50  Label             %50s   "Subject Label"

_column(77)         Personid          %10f   "Subject Id"

_column(88)         VisCycle          %5f    "Visit Cycle Number"

_column(94)         FrmCycle          %5f    "Form Cycle Number"

_column(100)        RepeatNo          %5f    "Question Repeat Number"

The following question fields are typed as follows:

    Text  as  % + DataItemLength + s

    Date(time)  as  %8s

    Date(date Standard)  as  %8.0g

    Date(date Float)  as  %8f

    Date(date+time)  as  %19s

    Partial Date  as  %10s

    Category(numeric codes)  as  %2f

    Category(alphnumeric codes)  as  %2s

    Multimedia  as  %36s

    IntegerData  as  % + DataItemLength + f

    Real  as  % + DataItemLength + "." + No. of Decimal Places + f

    LabTest  as  % + DataItemLength + "." + No. of Decimal Places + f

Category Codes file

The name of the Category Codes file is derived from the ResponseData filename, replacing .ana with .do

The default name is StudyName_YYYYMMDDSTATA.do

Formatted text file

Example:

label define QCatN1_   1  "Male"

                       2  "Female"

                       3  "Unkown" ;

label define Centre_   1  "London"

                       2  "Liverpool"

                       3  "Manchester"

                       4  "Leeds"

                       5  "Chester"

                       6  "Crewe"

                       7  "Halifax"

                       8  "Truro"

                       9  "Exeter"

                       10 "Wigan"

                       11 "Nottingham"

                       12 "Derby" ;

If special values are being used then the do file will include a replace section.

STATA uses the symbols . .a .b .c .d .e .f .g, .h and .i

STATA automatically allocates . to empty missing responses.

For the special values –1 to –9 the .a to .i STATA symbols will appear in the replace section.

The STATA symbols are only applicable to numeric and date fields, text fields are set to MISS, UNOB or NA, for the three statuses of Missing, Not Available and Not Applicable.

Example:

replace HospNo   = "MISS" if HospNo   == "-1" ;

replace HospNo   = "UNOB" if HospNo   == "-2" ;

replace HospNo   = "NA"   if HospNo   == "-3" ;

replace Initials = "MISS" if Initials == "-1" ;

replace Initials = "UNOB" if Initials == "-2" ;

replace Initials = "NA"   if Initials == "-3" ;

replace Qdob     = .a     if Qdob     == -1 ;

replace Qdob     = .b     if Qdob     == -2 ;

replace Qdob     = .c     if Qdob     == -3 ;

replace QText    = "MISS" if QText    == "-1" ;

replace QText    = "UNOB" if QText    == "-2" ;

replace QText    = "NA"   if QText    == "-3" ;

replace QReal    = .a     if QReal    == -1 ;

replace QReal    = .b     if QReal    == -2 ;

replace QReal    = .c     if QReal    == -3 ;

replace QCatN1   = .a     if QCatN1   == -1 ;

replace QCatN1   = .b     if QCatN1   == -2 ;

replace QCatN1   = .c     if QCatN1   == -3 ;

replace QCatA1   = "MISS" if QCatA1   == "-1" ;

replace QCatA1   = "UNOB" if QCatA1   == "-2" ;

replace QCatA1   = "NA"   if QCatA1   == "-3" ;

Question Look Up file

The name of the Question Look Up file is derived from the ResponseData filename, replacing .ana with _QLU.txt

The default name is StudyName_YYYYMMDDSTATA_QLU.txt

1 record per question

Provides Look Up from LongCodes to ShortCodes in the format VisitCode/FormCode/QuestionCode  TAB  ShortCode  TAB  Description  TAB   Type

 

 

Related Topics