|
Dear All, Angela Maupin |
|
Administrator
|
I suspect there is a Python-based solution to this. Nevertheless, here is a more old-fashioned approach (using native SPSS code only) that might do the trick. http://spsstools.net/Macros/Gems/vartype.txt Instead of: LIST !str. LIST !num. I think you could just do something like: missing values !str ("Missing" "N/A"). missing values !num(888 999).
--
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/). |
|
|
In reply to this post by Bruce Weaver
If you want a macro that selects variables according to type and other characteristics, take a look at the SPSSINC SELECT VARIABLES extension command available from SPSS Developer Central, www.spss.com/devcentral (Requires at least V17 and the Python programmability plugin). It can select based on any combination of variable type, measurement level, patterns in the name, and custom attributes from a specified list of variables or the entire dictionary. Here is an example selecting all numeric variables and running DESCRIPTIVES on them. SPSSINC SELECT VARIABLES MACRONAME="!numeric" /PROPERTIES TYPE=NUMERIC. DESCRIPTIVES !numeric. HTH, Jon Peck SPSS, an IBM Company [hidden email] 312-651-3435
Angela Maupin wrote: > > > > Dear All, > > Is there a function that will return whether a variable is a string or > numeric type? I wish to conditionally test variable type and then set > missing values. Pseudo code example: > > do if (vartype = string) then. > missing values .... > else if (vartype = numeric). > missing values .... > end if. > > Thanks! > > Angela Maupin > I suspect there is a Python-based solution to this. Nevertheless, here is a more old-fashioned approach (using native SPSS code only) that might do the trick. http://spsstools.net/Macros/Gems/vartype.txt Instead of: LIST !str. LIST !num. I think you could just do something like: missing values !str ("Missing" "N/A"). missing values !num(888 999). ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- View this message in context: http://old.nabble.com/variable-function-tp28168765p28169057.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 |
|
In reply to this post by Angela Maupin
The documentation mentions that SORT VARIABLES has a way to put the
original order in a custom attribute, but I do not see how to do that
via syntax.
Switch to the variable view and right click on <type> . click <sort ascending> and enter the name of the new custom attribute in the edit box. Look up the first and last string variable and the first and last numeric variable. Use that info to write your MISSING VALUES syntax. Sort the variables back into the original order. Art Kendall Social Research Consultants On 4/7/2010 1:59 PM, Angela Maupin wrote: ===================== 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
Art Kendall
Social Research Consultants |
|
In reply to this post by Angela Maupin
|
| Free forum by Nabble | Edit this page |
