syntax way to put file map from ADD Files to a data set

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

syntax way to put file map from ADD Files to a data set

Art Kendall
I am trying to show that three data sources are not compatible.
I ADD 3 files.
Old way that does not have a very clean  audit trail.
* move to output file
* copy-paste file map body to a new syntax file.
* wrap it in syntax to read it in as fixed
*with (4a33)
*run syntax.
*go to data view
*export to excel.

I would like  to have an all syntax way to get the excel file.
That way the whole process would be more easily reproduced in QA review.

Unfortunately, it would be more a bear to annotate in an automated way.
in excel
I then manually add a notes column with notes like
all 3 files have variables with the same name and same codes

all 3 files have variables with the different names and same codes. variables can be renamed
files have variables with same name but different codes.
variable is in only 2 files ...
codes differ only in case.
etc.
the reviewer then can go back and eyeball the datasets to see in (s)he concurs with the notes.


-- 
Art Kendall
Social Research Consultants
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: syntax way to put file map from ADD Files to a data set

David Marso
Administrator
Art,
Some of this newfangled OUTPUT EXPORT biz comes to mind.
Of course you know how to parse text using any number of techniques.
eg:
DATA LIST LIST/ a b c.
begin data
1 2 3
end data.
DATASET NAME f1.

DATA LIST LIST/ a b c (3A1).
begin data
1 2 3
end data.
DATASET NAME f2.
ADD FILES / FILE F1 / FILE f2 /MAP.
OUTPUT EXPORT /TEXT DOCUMENTFILE='tmp.txt'.
DATA LIST FILE 'tmp.txt' / A 1-200 (A).
DATASET NAME Addout.
IF (INDEX(A,"ADD FILES") GT 0) #keep=1.
SELECT IF (#KEEP).
LIST.
ERASE FILE 'tmp.txt'.



** RESULT **.

A

ADD FILES / FILE F1 / FILE f2 /MAP.

Map of the result file

Result                           Input1                           Input2
------                           ------                           ------

a                                a                                a
b                                b                                b
c                                c                                c


Variable(s) with conflicting type:

                                  -------Input1-------                     -------Input2-------
Result                            Type   Variable name                     Type   Variable name

a                                 num    a                                 s1     a
b                                 num    b                                 s1     b
c                                 num    c                                 s1     c

Codes:  num = numeric;  sn = string of length n

Error # 5127
Mismatched variable types on the input files.
Execution of this command stops.

Note # 5145
The working file has been restored, and subsequent commands may access the
working file.
OUTPUT EXPORT /TEXT DOCUMENTFILE='tmp.txt'.



Number of cases read:  32    Number of cases listed:  32



Art Kendall wrote
I am trying to show that three data
        sources are not compatible.
      I ADD 3 files.
      Old way that does not have a very clean  audit trail.
      * move to output file
        * copy-paste file map body to a new syntax file.
        * wrap it in syntax to read it in as fixed
        *with (4a33)
        *run syntax.
        *go to data view
        *export to excel.
       
    I would
                          like  to have an all syntax way to get
                            the excel file.
                  That way the whole process would
              be more easily reproduced in QA review.
               
                Unfortunately, it would be more a
                bear to annotate in an
                    automated way.
                in excel
              I then manually add a notes column with notes
                like
              all 3 files have variables with the same
                name and same codes
    all 3 files have variables with
                            the different names
                            and same codes. variables
                              can be renamed
                files have variables with same name but
                  different codes.
                  variable is in only 2 files ...
                        codes differ only in case.
                          etc.
                        the reviewer then can go back and eyeball
                              the datasets to see
                              in (s)he concurs with the notes.
                     
           
     
    --
Art Kendall
Social Research Consultants
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"