trouble with paths defined by macro

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

trouble with paths defined by macro

Little, Jonathon
Hi all good people of the SPSS variety,

is anyone able to clarify why my GET FILE command will not work?  The
warning I get back is

>A macro symbol is invalid in this context.

The syntax is

FILE HANDLE eddc_data/NAME= '\\Nt342\ShaZSd$\Health Data Collections\Non
Admitted Data\SPSS BASE DATA SETS\EDDC\'.

DEFINE !filename () "ED_BASE_25_JUL_2007_ALL" !ENDDEFINE.

GET FILE = eddc_data + !filename.sav.

Most appreciative of any help anyone can provide
 
Jonathon Little
<http://www.health.wa.gov.au/home/>
Reply | Threaded
Open this post in threaded view
|

Re: trouble with paths defined by macro

Marta Garcia-Granero
Hi Jonathon

I don't think FILE HANDLEs can be used that way.

Anyway, this should work:

FILE HANDLE eddc_data/NAME= '\\Nt342\ShaZSd$\Health Data Collections\Non '+
'Admitted Data\SPSS BASE DATA SETS\EDDC\'.

FILE HANDLE TheFile/NAME='eddc_data\ED_BASE_25_JUL_2007_ALL.sav'.

GET FILE = 'TheFile'.

HTH,
Marta Garcia-Granero

> is anyone able to clarify why my GET FILE command will not work?  The
> warning I get back is
>
>
>> A macro symbol is invalid in this context.
>>
>
> The syntax is
>
> FILE HANDLE eddc_data/NAME= '\\Nt342\ShaZSd$\Health Data Collections\Non
> Admitted Data\SPSS BASE DATA SETS\EDDC\'.
>
> DEFINE !filename () "ED_BASE_25_JUL_2007_ALL" !ENDDEFINE.
>
> GET FILE = eddc_data + !filename.sav.
Reply | Threaded
Open this post in threaded view
|

Re: trouble with paths defined by macro

Albert-Jan Roskam
From the SPSS manual (v15):

FILE HANDLE assigns a unique file handle to a path
and/or file and supplies operating system
specifications for the file

Examples:
FILE HANDLE thisMonthFile
/NAME='c:\sales\data\july.sav'.

* this is what you are trying to do:
FILE HANDLE dataDirectory /NAME='c:\sales\data'.
GET FILE 'thisMonthFile'.
GET FILE 'dataDirectory\july.sav'.

So what you're trying to do should be possible. But I
don't know what's going wrong in your case. How many
characters is the total path length, including the
file name itself? I vaguely remember that this should
not exceed a certain number, I believe it's 256
characters. But I am not sure that it was SPSS that
has this limitation.

Did you also look at the CD command. It might be
useful for you too.

Albert-Jan


--- Marta Garcia-Granero <[hidden email]>
wrote:

> Hi Jonathon
>
> I don't think FILE HANDLEs can be used that way.
>
> Anyway, this should work:
>
> FILE HANDLE eddc_data/NAME= '\\Nt342\ShaZSd$\Health
> Data Collections\Non '+
> 'Admitted Data\SPSS BASE DATA SETS\EDDC\'.
>
> FILE HANDLE
>
TheFile/NAME='eddc_data\ED_BASE_25_JUL_2007_ALL.sav'.

>
> GET FILE = 'TheFile'.
>
> HTH,
> Marta Garcia-Granero
>
> > is anyone able to clarify why my GET FILE command
> will not work?  The
> > warning I get back is
> >
> >
> >> A macro symbol is invalid in this context.
> >>
> >
> > The syntax is
> >
> > FILE HANDLE eddc_data/NAME=
> '\\Nt342\ShaZSd$\Health Data Collections\Non
> > Admitted Data\SPSS BASE DATA SETS\EDDC\'.
> >
> > DEFINE !filename () "ED_BASE_25_JUL_2007_ALL"
> !ENDDEFINE.
> >
> > GET FILE = eddc_data + !filename.sav.
>


Cheers!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


      ____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/