File references?

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

File references?

Robert L

This might be a question I really should know the answer to, but as I have tried almost everything with little success, I have to ask. I am simply wondering if

there is a way to use relative references to files in syntax rather than using absolute references? An example: instead of

 

GET

  FILE='J:\Arkiv\internt\allm_statistik\2011\ dotplot\data.sav'.

DATASET NAME DataSet1 WINDOW=FRONT.

 

I would like to have something like

 

GET

  FILE='data.sav'.

DATASET NAME DataSet1 WINDOW=FRONT.

 

After all, the syntax file is located within the same folder, so it should be possible to use a relative address, shouldn't it? The purpose is not only to get a neater syntax file, but also to make it easier to wrap all connected files together (data, syntax, graphics template,…) and send the whole package back to my clients.

 

Robert

Robert Lundqvist
Reply | Threaded
Open this post in threaded view
|

Re: File references?

Maclennan, Graeme S.
file handle dotplot/name = 'J:\Arkiv\internt\allm_statistik\2011\ dotplot'
get file = 'dotplot\data.sav'
 
hth, g.
 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Robert Lundqvist
Sent: 29 June 2011 07:54
To: [hidden email]
Subject: File references?

This might be a question I really should know the answer to, but as I have tried almost everything with little success, I have to ask. I am simply wondering if

there is a way to use relative references to files in syntax rather than using absolute references? An example: instead of

 

GET

  FILE='J:\Arkiv\internt\allm_statistik\2011\ dotplot\data.sav'.

DATASET NAME DataSet1 WINDOW=FRONT.

 

I would like to have something like

 

GET

  FILE='data.sav'.

DATASET NAME DataSet1 WINDOW=FRONT.

 

After all, the syntax file is located within the same folder, so it should be possible to use a relative address, shouldn't it? The purpose is not only to get a neater syntax file, but also to make it easier to wrap all connected files together (data, syntax, graphics template,…) and send the whole package back to my clients.

 

Robert



The University of Aberdeen is a charity registered in Scotland, No SC013683.
Reply | Threaded
Open this post in threaded view
|

Re: File references?

Garry Gelade
In reply to this post by Robert L

Hi Robert

 

CD (Change Directory) is what you want.  After issuing the CD command you can use relative paths. eg

 

CD 'J:\Arkiv\internt\allm_statistik\2011\ dotplot’.

 

GET FILE='data.sav'.

DATASET NAME DataSet1 WINDOW=FRONT.

 

 

Garry Gelade

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Robert Lundqvist
Sent: 29 June 2011 07:54
To: [hidden email]
Subject: File references?

 

This might be a question I really should know the answer to, but as I have tried almost everything with little success, I have to ask. I am simply wondering if

there is a way to use relative references to files in syntax rather than using absolute references? An example: instead of

 

GET

  FILE='J:\Arkiv\internt\allm_statistik\2011\ dotplot\data.sav'.

DATASET NAME DataSet1 WINDOW=FRONT.

 

I would like to have something like

 

GET

  FILE='data.sav'.

DATASET NAME DataSet1 WINDOW=FRONT.

 

After all, the syntax file is located within the same folder, so it should be possible to use a relative address, shouldn't it? The purpose is not only to get a neater syntax file, but also to make it easier to wrap all connected files together (data, syntax, graphics template,…) and send the whole package back to my clients.

 

Robert

Reply | Threaded
Open this post in threaded view
|

Re: File references?

John F Hall
In reply to this post by Robert L

What’s wrong with opening the relevant folder and double-clicking on the *.sav file?  The syntax gets saved anyway and it saves a few key-depressions.  If you save the *.sps syntax files, you can edit them all, save them in the same folder and send the whole thing to your client.  Output files optional as SPSS is so fast it usually only takes seconds to reproduce them.

 

 

John F Hall

 

[hidden email]

www.surveyresearch.weebly.com

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Robert Lundqvist
Sent: 29 June 2011 08:54
To: [hidden email]
Subject: File references?

 

This might be a question I really should know the answer to, but as I have tried almost everything with little success, I have to ask. I am simply wondering if

there is a way to use relative references to files in syntax rather than using absolute references? An example: instead of

 

GET

  FILE='J:\Arkiv\internt\allm_statistik\2011\ dotplot\data.sav'.

DATASET NAME DataSet1 WINDOW=FRONT.

 

I would like to have something like

 

GET

  FILE='data.sav'.

DATASET NAME DataSet1 WINDOW=FRONT.

 

After all, the syntax file is located within the same folder, so it should be possible to use a relative address, shouldn't it? The purpose is not only to get a neater syntax file, but also to make it easier to wrap all connected files together (data, syntax, graphics template,…) and send the whole package back to my clients.

 

Robert

Reply | Threaded
Open this post in threaded view
|

Re: File references?

Jon K Peck
In reply to this post by Robert L
There are two solutions here.  To set the location that things should be relative to, use the SPSS CD command to change the working directory.

Second, check out file handles (FILE HANDLE).  These let you define symbolic location references that can be used in file specifications, so you only need to set it once.

HTH,

Jon Peck
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Robert Lundqvist <[hidden email]>
To:        [hidden email]
Date:        06/29/2011 12:56 AM
Subject:        [SPSSX-L] File references?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




This might be a question I really should know the answer to, but as I have tried almost everything with little success, I have to ask. I am simply wondering if
there is a way to use relative references to files in syntax rather than using absolute references? An example: instead of
 
GET
  FILE='J:\Arkiv\internt\allm_statistik\2011\ dotplot\data.sav'.
DATASET NAME DataSet1 WINDOW=FRONT.
 
I would like to have something like
 
GET
  FILE='data.sav'.
DATASET NAME DataSet1 WINDOW=FRONT.
 
After all, the syntax file is located within the same folder, so it should be possible to use a relative address, shouldn't it? The purpose is not only to get a neater syntax file, but also to make it easier to wrap all connected files together (data, syntax, graphics template,…) and send the whole package back to my clients.
 
Robert