Main Page | Report this Page
 
   
Science Forum Index  »  Space - Consult Forum  »  KEEP command in SPSS...
Page 1 of 1    
Author Message
A.A.A...
Posted: Wed Jun 11, 2008 11:57 pm
Guest
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
at (no spam) 1_mean then at (no spam) 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 at (no spam) 1_mean at (no spam) 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 at (no spam) 1_mean then at (no spam) 2_mean,…………So, where is the
problem??????????????????????????????


Great thanks
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Wed Jan 07, 2009 10:00 pm