LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2010)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 23 Jun 2010 06:56:06 -0600
Reply-To:   Jon K Peck <peck@us.ibm.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Jon K Peck <peck@us.ibm.com>
Subject:   Re: Adding a date to a file name through syntax
Comments:   To: Andreas Voelp <andreas.voelp@gmx.de>
In-Reply-To:   <28968491.post@talk.nabble.com>
Content-Type:   multipart/alternative;

You can generate file names with date and time information using the function CreateFileNameWDate in the spssaux2.py module available from SPSS Developer Central (www.spss.com/devcentral). There is a companion function in the same module named FindMostRecentFile that will return the file name of the most recent file by using the naming structure produced by the first function.

Here is an example program that saves the active data file using this naming scheme. begin program. import spss, spssaux, spssaux2 spssaux.SaveDataFile(spssaux2.CreateFileNameWDate(basename="Andreas")) end program.

You can omit the basename if the active file already has a name, and the function will build a dated name from the current name (removing any date stamp it already had).

HTH,

Jon Peck SPSS, an IBM Company peck@us.ibm.com 312-651-3435

From: Andreas Voelp <andreas.voelp@gmx.de> To: SPSSX-L@LISTSERV.UGA.EDU Date: 06/23/2010 01:14 AM Subject: [SPSSX-L] Adding a date to a file name through syntax Sent by: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>

I would like to add the current date to the file name automatically when saving data files from SPSS using command syntax, as in

SAVE TRANSLATE OUTFILE='xy 2010-06-23.csv'

(however, the date string should be updated automatically to the current date).

Can anybody think of a solution?

Andreas.

-- View this message in context: http://old.nabble.com/Adding-a-date-to-a-file-name-through-syntax-tp28968491p28968491.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


[text/html]


Back to: Top of message | Previous page | Main SPSSX-L page