matching files to an empty dataset

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

matching files to an empty dataset

raw
Dear all,

I would like to match some files.

I've used previously a macro which calculate an index and create several datasets, each having the name of the original variable exploited, so the datasets are img01 img_02 img_03, each having one case and one variable.

I want to match these datasets, but I have to declare the first dataset in use: I'm thinking about creating an empty dataset and then matching all the files to it.

So the question is, how to create by syntax an empty dataset and if is it possible to match datasets to this empty dataset.

Of course I could modify the macro in order to declare in use the first dataset img01, but I would like to keep the macro as flexible as possible.

Thanks



DEFINE cad (string=!CMDEND).
!DO !S !IN (!string)
DATASET activate Empty.
MATCH FILES /FILE=*
  /FILE=!quote(!s).
EXECUTE.
!DOEND
!ENDDEFINE.

cad string= img01 img_02 img_03.
Reply | Threaded
Open this post in threaded view
|

Re: matching files to an empty dataset

Jignesh Sutar
Depending on the specifics of the job you may want to setup accordingly (for example create a empty example dataset with expected column names/labels from all dataset to be merged ect) however below is a simple example:

Note ADD FILES shall allow you to merge at most 50 files in one go.

dataset close all.
new file.
output close all.

data list free / ID.
begin data
end data.
dataset name dsMaster.

data list free / ID v1.
begin data
1 1
end data.
dataset name ds1.

data list free / ID v2.
begin data
2 2
end data.
dataset name ds2.

data list free / ID v3.
begin data
3 3
end data.
dataset name ds3.

dataset activate dsMaster.
add files file=* /file=ds1 /file=ds2 /file=ds3.

dataset activate dsMaster.
dataset close all.
dataset name dsMaster.
Reply | Threaded
Open this post in threaded view
|

Re: matching files to an empty dataset

David Marso
Administrator
In reply to this post by raw
Oh my ;-)
Making it way too complicated grasshopper.
---

DEFINE cad (string=!CMDEND).
MATCH FILES !DO !s !IN(!string)  /FILE=!quote(!s) !DOEND
!ENDDEFINE.

cad string= img01 img_02 img_03.

Result *
MATCH FILES /FILE= 'img01' /FILE= 'img_02' /FILE= 'img_03' .


raw wrote
Dear all,

I would like to match some files.

I've used previously a macro which calculate an index and create several datasets, each having the name of the original variable exploited, so the datasets are img01 img_02 img_03, each having one case and one variable.

I want to match these datasets, but I have to declare the first dataset in use: I'm thinking about creating an empty dataset and then matching all the files to it.

So the question is, how to create by syntax an empty dataset and if is it possible to match datasets to this empty dataset.

Of course I could modify the macro in order to declare in use the first dataset img01, but I would like to keep the macro as flexible as possible.

Thanks



DEFINE cad (string=!CMDEND).
!DO !S !IN (!string)
DATASET activate Empty.
MATCH FILES /FILE=*
  /FILE=!quote(!s).
EXECUTE.
!DOEND
!ENDDEFINE.

cad string= img01 img_02 img_03.
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?"
Reply | Threaded
Open this post in threaded view
|

Re: matching files to an empty dataset

Art Kendall
In reply to this post by raw
perhaps go back and start over, since you created the data with macros.

please explain the context and goals of the whole effort.

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

Re: matching files to an empty dataset

David Marso
Administrator
Don't know that we really require any context here.
It seems that OP simply is under the mistaken impression that one needs a 'blank data set' to do the merge.  Not true, a simple mod to the macro works fine.



Art Kendall wrote
perhaps go back and start over, since you created the data with macros.

please explain the context and goals of the whole effort.
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?"
Reply | Threaded
Open this post in threaded view
|

Re: matching files to an empty dataset

Art Kendall
Perhaps your E-SPSS is better than mine.

It "seemed to me" the OP wanted to build a "backbone" for something like 1 record per day over a time span or some form of repeated measure.

We both may be guessing.
One of my soapboxes in consulting in general is that "it is extremely rare for the presenting question to be the actual question".
Art Kendall
Social Research Consultants
raw
Reply | Threaded
Open this post in threaded view
|

Re: matching files to an empty dataset

raw
In reply to this post by David Marso
your solution it's fine thanks.

I tried something like this, but it did not work, may be my error was adding the execute inside the macro.

so i thought that i needed to create the empty dataset as workaround.

instead you would put the execute just after the macro, right?  
Reply | Threaded
Open this post in threaded view
|

Re: matching files to an empty dataset

David Marso
Administrator
In general, one rarely requires EXECUTE.
Excessive use belies noobishness.
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?"