|
Hi,
I want to do repeated analysis on a set of 25 variables that are not contiguous in the dataset. I can cut and past them in each time but it takes a lot of space in the editor so I want to give them an alias. I know I can make a new file with a subset of variables in it but I would rather just work out of one file. I tried defining them as a variable set from the menu and then using the name of the set to replace the variable names in a freq command but that did not work. I see there is a syntax subcommand called varsets but not sure if that will work? Thanks, Jan ===================== 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 |
|
Variable sets are not visible to syntax at all, but there is an extension command, SETSMACRO, and dialog box Utilities>Generate Syntax from Sets, that will generate a macro listing the variables in a set or in all sets. This requires the Python programmability plug. The command and plugin can be downloaded from SPSS Developer Central (www.spss.com/devcentral). HTH, Jon Peck SPSS, an IBM Company [hidden email] 312-651-3435
Hi, I want to do repeated analysis on a set of 25 variables that are not contiguous in the dataset. I can cut and past them in each time but it takes a lot of space in the editor so I want to give them an alias. I know I can make a new file with a subset of variables in it but I would rather just work out of one file. I tried defining them as a variable set from the menu and then using the name of the set to replace the variable names in a freq command but that did not work. I see there is a syntax subcommand called varsets but not sure if that will work? Thanks, Jan ===================== 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 |
|
In reply to this post by J McClure
Are you working with syntax or the GUI? If GUI, you should PASTE the syntax
for the 25 vars and save the resulating line(s) in a separate syntax file. Then all you do is copy the line to any new jobs, or better still keep the basic syntax in one file, and when you need it for another run, open the file, add whatever other syntax you need, then save it with another name. Syntax files don't have to be complete: I have chunks of partial syntax in several files for sets of vars used frequently ( eg demog.sps for standard demographic vars used in means or crosstabs; mult.sps for multiple response sets etc.) Make sure you leave at least one space at the beginning of the line(s). Another trick is to re-order the vars in the file, but that may be counterproductive. John Hall [hidden email] http://surveyresearch.weebly.com ----- Original Message ----- From: J McClure To: [hidden email] Sent: Monday, August 23, 2010 2:02 AM Subject: how do I define an alias for a set of vars? Hi, I want to do repeated analysis on a set of 25 variables that are not contiguous in the dataset. I can cut and past them in each time but it takes a lot of space in the editor so I want to give them an alias. I know I can make a new file with a subset of variables in it but I would rather just work out of one file. I tried defining them as a variable set from the menu and then using the name of the set to replace the variable names in a freq command but that did not work. I see there is a syntax subcommand called varsets but not sure if that will work? Thanks, Jan ===================== 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 ===================== 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 |
|
In reply to this post by J McClure
Jan,
I would use a simple macro in the syntax file. At the top of the file (or anywhere before the first time you want to use the "alias") put the following: DEFINE !varset () var1 var2 var3 .... var25. !ENDDEFINE. You can change the name "varset" if you want but keep the exclamation point, and obviously replace var1 ... var25 with the names of your 25 variables. Now, you simply use !varset as an "alias" for the 25 names. For example, in the following command you will get frequency tables for each of the 25 variables: FREQUENCIES VARIABLES = !varset. -- Greg Hurtz, Ph.D. Associate Professor Industrial & Organizational Psychology California State University, Sacramento http://www.csus.edu/indiv/h/hurtzg ________________________________________ From: SPSSX(r) Discussion [[hidden email]] On Behalf Of J McClure [[hidden email]] Sent: Sunday, August 22, 2010 5:02 PM To: [hidden email] Subject: how do I define an alias for a set of vars? Hi, I want to do repeated analysis on a set of 25 variables that are not contiguous in the dataset. I can cut and past them in each time but it takes a lot of space in the editor so I want to give them an alias. I know I can make a new file with a subset of variables in it but I would rather just work out of one file. I tried defining them as a variable set from the menu and then using the name of the set to replace the variable names in a freq command but that did not work. I see there is a syntax subcommand called varsets but not sure if that will work? Thanks, Jan ===================== 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 ===================== 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 |
|
Administrator
|
Here are some examples of the macro method.
http://www.angelfire.com/wv/bwhomedir/spss/macros_for_var_lists.txt http://www.angelfire.com/wv/bwhomedir/spss/re_macros_for_var_lists.txt
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
| Free forum by Nabble | Edit this page |
