KEEP command in SPSS
- From: "A.A.A" <ayafeps@xxxxxxxxx>
- Date: Thu, 12 Jun 2008 02:44:59 -0700 (PDT)
Hi,
I am writting an SPSS syntax that is used to compute some averages
and
probabilities based on a simulated data set (The data is simulated
using GAMS software). I have 100 datasets each one saved in a
separate
excel file(datas1.xls,
datas2.xls..........................,datas100.xls). The Spss syntax
should first get the data saved in the excel format apply the syntax
and then save the output in a different excel file and this should be
done for each dataset of the 100. How could i repeat my syntax 100
times,so that it can bring each one of the 100 datasets ,apply the
syntax to each dataset and then save the results of each data on 100
different excel files?
And i applied this syntax:
Define !xel().
!do !i=1 !to 100.
GET DATA
/TYPE=XLS
/FILE=!Quote(!concat('C:\filepath\datas', !i, '.xls'))
/SHEET=name 'sheetname'
/CELLRANGE=full
/READNAMES=on
/ASSUMEDSTRWIDTH=32767.
/* Put other syntax in here.
SAVE TRANSLATE OUTFILE=!Quote(!concat('C:\filepath\datas', !i,
'.xls'))
/TYPE=XLS
/VERSION=8
/MAP
/REPLACE
/FIELDNAMES
/CELLS=VALUES.
!doend.
!Enddefine.
!Xel.
And it works without errors but the problem is that I want to save
the
excel files so that the columns are with a certain order v1 then
@1_mean then @2_mean,………..so I put after the save translate command
the "keep" command as follows:
SAVE TRANSLATE OUTFILE=!QUOTE(!concat('E:\simuldata1\', 'datag', !i,
'.xls'))
/TYPE=XLS /VERSION=8 /MAP /REPLACE /keep v1 @1_mean @2_mean v2 v3
v4 v5 v6 V14_mean1 v7 V14_mean2 v8 V14_mean3 v9 V14_n.
But unfortunately the excel files were saved without the order of
columns I need: v1 then @1_mean then @2_mean,…………So, where is the
problem??????????????????????????????
Great thanks
.
- Prev by Date: MULTIMEDIA
- Next by Date: Re: definition
- Previous by thread: MULTIMEDIA
- Next by thread: Re: definition
- Index(es):
Loading