Error # 4311 Spss
från GoogleLogga inDolda fältSök efter grupper eller meddelanden
SPSS Convert String to Numeric Variable Introduction Many SPSS tutorials suggest converting string to numeric variables by simply running ALTER TYPE. However, we'll demonstrate why blindly doing so is about the worst advice you can get on this. This tutorial shows how to convert string to numeric variables properly. We'll check for problematic cases and resolve them if necessary. We recommend you follow along by downloading and opening revenue_expenses.sav. SPSS ALTER TYPE Command The basic way https://groups.google.com/d/topic/comp.soft-sys.stat.spss/U7Tf588rhS4 to convert a string variable to a numeric variable is ALTER TYPE.ALTER TYPE was introduced in SPSS version 16. We'll propose an alternative way to convert string to numeric variables for users on SPSS versions 15 and lower here. Now, the tricky part is that ALTER TYPE will overwrite the original string values with new http://www.spss-tutorials.com/spss-convert-string-to-numeric-variable/ numeric values. However, string values that can't be converted to numeric ones will be replaced by system missing values without any warning or error. Best case scenario, you'll quickly detect such cases. However, finding out if anything went wrong is complicated because the original values are gone. Worst case scenario, you may not detect such cases and end up with incorrect research conclusions. Playing it Safe An easy solution to the problem is to convert a copy of your string variable instead of the original.A great tool for copying variables and all their dictionary information is downloadable from Clone Variables. Immediately after the conversion, check whether system missing values are present in the converted variable. If so, you can see from the original values whether something went wrong or you're good to go. The syntax below demonstrates the safe way to convert a string variable into a numeric variable. SPSS String to Numeric Syntax Example 1 *1. String command for c
String Tweet Welcome to Talk Stats! Join the discussion today by registering your FREE account. Membership benefits: • Get your questions answered by community gurus and expert researchers. • Exchange your learning http://www.talkstats.com/showthread.php/44358-Numeric-to-String and research experience among peers and get advice and insight. Join Today! + http://www.ats.ucla.edu/stat/spss/faq/crstring.htm Reply to Thread Results 1 to 3 of 3 Thread: Numeric to String Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 06-08-201305:33 PM #1 cgonzal6 View Profile View Forum Posts Give Away Points Location Utah Posts 2 Thanks 0 error # Thanked 0 Times in 0 Posts Numeric to String Hey guys! I am doing bars in SPSS but I keep getting error #4311 which is basically that I did not supply a string variable and I think it is because it is reading my variables as numeric. My question is: how can I make the change of my variables from numeric to string variables in the following syntax: error # 4311 ***Faith Qualitative. string f_qualfreq (A2000). string f_qualimp (A2000). string f_qualsex (A2000). string f_qualalc (A2000). compute f_qualfreq = concat(rtrim('pfaithsqfr'), " || " , rtrim('pfaithsqfY')). compute f_qualimp = concat(rtrim('pfaithsqim'), " || " , rtrim('pfaithsqiY')). compute f_qualsex = concat(rtrim('pfthsinsex'), " || " , rtrim('pfthsYsex')). compute f_qualalc = concat(rtrim('pfthsinalc'), " || " , rtrim('pfthsYalc')). execute. I appreciate any response. Thanks in advance Reply With Quote 06-10-201308:54 AM #2 Robert Jones View Profile View Forum Posts Location Gloucester Posts 74 Thanks 0 Thanked 12 Times in 12 Posts Re: Numeric to String I presume it is your source variables that are numeric, e.g. pfaithsqfr. Have a look at the Command Syntax Reference manual, then look up Universals which is near the top of the index then expand the entries and scroll down to transformation expressions and look under string/numeric conversion functions Reply With Quote 06-12-201309:47 AM #3 cgonzal6 View Profile View Forum Posts Location Utah Posts 2 Thanks 0 Thanked 0 Times in 0 Posts Re: Numeric to String Thank you so much Mr. Jones, I really appreciate it. Reply With Quote + Reply to Thread Tweet « Grouping multiple survey question to obtain 1 Mean & Std. Dev. | How to get
variables? There are at least two ways to create a string variable in SPSS. In our first example, we show how to input string variables into a new data set. In the next example, we show how to create a string variable in an existing data set. In the last example, we will show how to removed unwanted characters from a string variable. Example 1: Inputting string variables into a new data set In this example, we will enter an id number, the first and last name, age and weight for nine folks. All of the variables will be numeric, except of course, the names. We will also save the file. data list list / id * fname (A5) lname (A10) age wt. begin data 1 "Beth" "Jones" 20 . 2 "Bob" "Jensen" 23 210 3 "Barb" "Andersen" 25 125 4 "Andy" "Smith" 26 160 5 "Al" "Peterson" 21 190 6 "Ann" "Glenn" 22 115 7 "Pete" "." 29 175 8 "Pam" "Wright" 21 145 9 "Phil" "Brown" 29 200 end data. save outfile 'c:\names.sav'. The (A_) after fname and lname tells SPSS that the variable(s) before that option are string variables, and they have a length of five and ten, respectively. If you are listing only one string variable and there is one or more numeric variables listed before the string variable, you need to put an asterisk before the name of the string variable to tell SPSS that the variables listed before the asterisk are numeric variables. Hence, the asterisks (*) after id is necessary because SPSS assumes that all variables listed before (A8) option are string variables. The asterisk tells SPSS that all prior variables are numeric. You may also notice that SPSS produced an error message, shown below, while reading in the data. It was caused by the missing data value for wt in case 1. Despite this error message, the data were read in correctly, as we can see by using the list command. An error message was not generated for the missing value in lname in case 7 because "." is a valid value in a string variable. In other words, SPSS does not consider it a missing value. We will return to this issue shortly. >Warning # 1111 >A numeric field contained no digits. The result has been set to the >system-missing value. >Command line: 978 Current case: 1 Current splitfile group: 1 >Field contents: '.' >Record number: 1 Starting column: 21 Record length: 21 list. ID FNAME LNAME AGE WT 1.00 Beth Jones 20.00 . 2.00 Bob Jensen 23.00 210.00 3.00 Barb Andersen 25.00 125.00 4.00 Andy Smith 26.00 160.00 5.00 Al Peterson 21.00 190.00 6.00 Ann Glenn 22.00 11