Re: SAVE vs. XSAVE

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: SAVE vs. XSAVE

John Norton
Hi Eugenio and List,
 
As I understand it, the XSAVE command is actually a transformation command which allows the user to save data from within a transformation procedure, thus:
 
DO IF (age < 19).
XSAVE OUTFILE = 'c:\temp\juvenile.sav'.
ELSE IF (age > 18 AND age < 65).
XSAVE OUTFILE = 'c:\temp\adult.sav'.
ELSE IF (age > 64).
XSAVE OUTFILE = 'c:\temp\senior.sav'.
END IF.
 
This allows the user to select and create a separate file or subset of cases from an active file without having to reiteratively read, select cases and save from the same source file.
 
Regarding your need to keep the same file name without having to write it every time, I saw something similar done once in a macro, thus:
 
DEFINE !pathd() 'c:\temp\' !ENDDEFINE.
 
You would replace the file path in the above definition between the single quotes.  Then, when reading a file, you'd execute a GET command similar to the one below (editing the actual file name for your preference):
 
GET FILE= !pathd + "population.sav".
 
When saving a file, you'd execute a SAVE OUTFILE command similar to the one below (again editing the actual file name for your preference):

SAVE OUTFILE=!pathd + "population.sav" .

I hope the above examples suggest a way to tackle your challenge.
 
 
John Norton
Biostatistician
Oncology Institute
Loyola University Medical Center
 
(708) 327-3095
[hidden email]
 
"Absence of evidence
      is not evidence of absence"