Reading in data from a file is easy.
Defining a global variable isn't too hard by using !DEFINE. But how do I read in variables from a file and use them as a global variables? In particular I'm looking to read in the month and the year. I want to use these in a couple of places. For one, I want to use when querying from a relational table. Second, after I've done some calculations on the data, I want to do a forecast forward 3 months from the month in the file. Any suggestions? I could just read in the data from the table and then join it with the "global file" and drop any records that are newer than the global month/year. And then for forecasting...now that I think about it, it seems like I can tell the TSMODEL procedure to just forecast out 3 periods, right? But somehow it seems like I've never got that to work correctly. Am I supposed to be able to do that? If so, I suppose that's an option, but it would still be handy to know if there's a way to read in global variables from a file. (Did that used to be an option with global.sps? I just started with SPSS as of version 18, so I'm definitely not knowledgable on backwards compatibility.) |
Typically, global variables are not of
casewise dimension, so merging them with casewise data is not optimal.
And global.sbs was just for Basic scripting.
The simplest way to set global values would be to INSERT a file of macro definitions. Those could then be referenced in the relevant syntax. A more flexible solution would be to use Python programmability to read and build syntax from those values. It could even generate macro definitions, including perhaps on for use in PREDICT ... THRU for TSMODEL/TSAPPLY. HTH, Jon Peck (no "h") Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Mark Lavender <[hidden email]> To: [hidden email] Date: 10/03/2011 07:30 AM Subject: [SPSSX-L] Reading in global variables from a file Sent by: "SPSSX(r) Discussion" <[hidden email]> Reading in data from a file is easy. Defining a global variable isn't too hard by using !DEFINE. But how do I read in variables from a file and use them as a global variables? In particular I'm looking to read in the month and the year. I want to use these in a couple of places. For one, I want to use when querying from a relational table. Second, after I've done some calculations on the data, I want to do a forecast forward 3 months from the month in the file. Any suggestions? I could just read in the data from the table and then join it with the "global file" and drop any records that are newer than the global month/year. And then for forecasting...now that I think about it, it seems like I can tell the TSMODEL procedure to just forecast out 3 periods, right? But somehow it seems like I've never got that to work correctly. Am I supposed to be able to do that? If so, I suppose that's an option, but it would still be handy to know if there's a way to read in global variables from a file. (Did that used to be an option with global.sps? I just started with SPSS as of version 18, so I'm definitely not knowledgable on backwards compatibility.) -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Reading-in-global-variables-from-a-file-tp4864841p4864841.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
Free forum by Nabble | Edit this page |