Hi Guys:
I have a (*.dbf) table that I export to SPSS via GET TRANSLATE FILE='C:\Work\filename.DBF' /TYPE=DBF /MAP. EXECUTE . All exported variables are String type, if I try to transform then via syntax: FORMATS Var01 (F2). >Error # 4836 in column 9. Text: Var01 >Only the formats A and AHEX can be applied to string variables. >This command not executed. but if I do it by clicking in the variable and then I "manually" change the format type I can do it. The problem is that this should be done on 75 variables and the FORMATS commnad is way faster. What gives??? |
Lee Wilkinson of SPSS recently proposed some improvements to the traditional Pareto chart.
Wilkinson, Leland. "Revising the Pareto Chart". The American Statistician, November 2006, Vol. 60, No. 4 pp. 332-334 Chief among this is the display of acceptance intervals for the (sorted) counts, since purely random data when sorted will tend to exhibit a Pareto-like appearance. We have posted a new Python module, paretochart.py, on SPSS Developer Central (www.spss.com/devcentral) that produces this chart. It uses SPSS AGGREGATE to construct the aggregated counts, Monte Carlo simulation using Python to construct the acceptance intervals, and GGRAPH and GPL to generate the chart. This sounds complicated, but usage can be as simple as begin program. import paretochart paretochart.chart("varname") end program. There are some optional parameters as well. Besides the general utility of this chart, this module illustrates the ease of putting all this together using Python. The module requires SPSS 15.0.1 and current versions of the spssaux and spssdata modules on Developer Central. We hope you find this useful. Regards, Jon Peck SPSS |
In reply to this post by Eugenio Grant
Why would you think it's an error? Look at the error message. You cannot change a string variable to a numeric variable by specifying the FORMAT command. Look at the STRING command to declare new strings and the NUMERIC function.
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Eugenio Grant Sent: Monday, January 22, 2007 10:43 AM To: [hidden email] Subject: Is this an SPSS Error? Hi Guys: I have a (*.dbf) table that I export to SPSS via GET TRANSLATE FILE='C:\Work\filename.DBF' /TYPE=DBF /MAP. EXECUTE . All exported variables are String type, if I try to transform then via syntax: FORMATS Var01 (F2). >Error # 4836 in column 9. Text: Var01 >Only the formats A and AHEX can be applied to string variables. >This command not executed. but if I do it by clicking in the variable and then I "manually" change the format type I can do it. The problem is that this should be done on 75 variables and the FORMATS commnad is way faster. What gives??? |
Because the magic of converting a string to a new numeric variable, deleting the old string variable, and then renaming the string variable to the original variable name is done internally and not through syntax. And that's pretty much how you would have to do it yourself via syntax. The Data editor generally doesn't do all its functions via syntax because it has more intimate knowledge of the active file.
-----Original Message----- From: Eugenio Grant [mailto:[hidden email]] Sent: Monday, January 22, 2007 11:02 AM To: Beadle, ViAnn Subject: RE: Is this an SPSS Error? Hi: But my question is why I can do it "manually" and then copy the syntax provided, and not been able to do it via Syntax. I do it once manually, copy the syntax and run it and it not works. Thanks, ______________________________ Eugenio Grant Mora Investigación de Medios Ipsos Costa Rica Tel 257-0304 -----Mensaje original----- De: SPSSX(r) Discussion [mailto:[hidden email]] En nombre de Beadle, ViAnn Enviado el: Lunes, 22 de Enero de 2007 10:55 a.m. Para: [hidden email] Asunto: Re: Is this an SPSS Error? Why would you think it's an error? Look at the error message. You cannot change a string variable to a numeric variable by specifying the FORMAT command. Look at the STRING command to declare new strings and the NUMERIC function. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Eugenio Grant Sent: Monday, January 22, 2007 10:43 AM To: [hidden email] Subject: Is this an SPSS Error? Hi Guys: I have a (*.dbf) table that I export to SPSS via GET TRANSLATE FILE='C:\Work\filename.DBF' /TYPE=DBF /MAP. EXECUTE . All exported variables are String type, if I try to transform then via syntax: FORMATS Var01 (F2). >Error # 4836 in column 9. Text: Var01 >Only the formats A and AHEX can be applied to string variables. >This command not executed. but if I do it by clicking in the variable and then I "manually" change the format type I can do it. The problem is that this should be done on 75 variables and the FORMATS commnad is way faster. What gives??? |
In reply to this post by Eugenio Grant
I think this is a common mistake. In the data editor pane, one can simply
change a string by changing the DataType. Of course, changing numbers to strings is seamless, but changing non-number string characters to strings gets you missing data BUT NO ERROR MESSAGE. I think this leads some people to believe that changing Data Type ( or numerous other things) is as easy as flipping through the editor pane. This is almost never the case. This is the core of my concern about teaching students nothing more that to flip through menu panes. You will need to do something akin to this: Here, the variables that I read in as numeric rather than string are LLINE01 to LLINE14. This is the syntax produced from the database wizard. GET DATA /TYPE=ODBC /CONNECT= 'DSN=dBASE Files;DefaultDir=C:\CRATE AND'+ ' BARREL\MAILFILES_KEYED;DriverId=533;FIL=dBase 5.0;MaxBufferSize=2048;' 'PageTimeout=5;' /SQL = 'SELECT BARCODE, ZIP, PLUS4, DP2, DPC, CRRT, ADDRESS_1, CITY,'+ ' STATE, FNAME1, LNAME1, FILENAME, ERR_STAT, ' 'PURPRICE, CLOSEDATE, SOURCE, FILEDATE, EXPDATE, PLANETCODE, MMUNIQID'+ ', LOC1, DISTANCE, LOCADDR1, LOCADDR2, ' 'LOCCITY, LOCSTATE, LOCZIP, PHONE, MONDAY, TUESDAY, WEDNESDAY, '+ ' THURSDAY, FRIDAY, SATURDAY, SUNDAY, REGION, ' 'MISC, LLINE01, LLINE02, LLINE03, LLINE04, LLINE05, LLINE06, LLINE07'+ ', LLINE08, LLINE09, LLINE10, LLINE11, ' 'LLINE12, LLINE13, LLINE14, PACKAGE, CONTAINER, ENDORSE, BREAKMARK, '+ ' ACS_PART, ACS_KEY, SEQ_NO FROM mail' /ASSUMEDSTRWIDTH=255 . CACHE. AUTORECODE LLINE01 LLINE02 LLINE03 LLINE04 LLINE05 LLINE06 LLINE07 LLINE08 LLINE09 LLINE10 LLINE11 LLINE12 LLINE13 LLINE14 /INTO tm4 tm6 tm8 tm9 tm10 tm11 tm12 tm13 tm14 tm1 tm2 tm3 tm5 tm7 . DELETE VARIABLES LLINE01 LLINE02 LLINE03 LLINE04 LLINE05 LLINE06 LLINE07 LLINE08 LLINE09 LLINE10 LLINE11 LLINE12 LLINE13 LLINE14 . RENAME VARIABLES (tm4 = LLINE01)(tm6 = LLINE02)(tm8 = LLINE03)(tm9 = LLINE04)(tm10 = LLINE05)(tm11 = LLINE06)(tm12 = LLINE07)(tm13 = LLINE08)(tm14 = LLINE09)(tm1 = LLINE10)(tm2 = LLINE11)(tm3 = LLINE12)(tm5 = LLINE13)(tm7 = LLINE14) This was created using the Database Wizard which prompts you to recode string to numeric. Granted, it means clicking 75 little boxes but its better than most of the alternatives, including editing syntax if you variables are not numbered sequntially. I have a screenshot handout that I give students that shows step-by-step how to use the Database Wizard. Let me know if you want a copy. . *************************************************************************************************************************************************************** Mark A. Davenport Ph.D. Senior Research Analyst Office of Institutional Research The University of North Carolina at Greensboro 336.256.0395 [hidden email] 'An approximate answer to the right question is worth a good deal more than an exact answer to an approximate question.' --a paraphrase of J. W. Tukey (1962) Eugenio Grant <[hidden email]> Sent by: "SPSSX(r) Discussion" <[hidden email]> 01/22/2007 11:42 AM Please respond to Eugenio Grant <[hidden email]> To [hidden email] cc Subject Is this an SPSS Error? Hi Guys: I have a (*.dbf) table that I export to SPSS via GET TRANSLATE FILE='C:\Work\filename.DBF' /TYPE=DBF /MAP. EXECUTE . All exported variables are String type, if I try to transform then via syntax: FORMATS Var01 (F2). >Error # 4836 in column 9. Text: Var01 >Only the formats A and AHEX can be applied to string variables. >This command not executed. but if I do it by clicking in the variable and then I "manually" change the format type I can do it. The problem is that this should be done on 75 variables and the FORMATS commnad is way faster. What gives??? |
In reply to this post by Beadle, ViAnn
At 12:07 PM 1/22/2007, Beadle, ViAnn wrote:
>Because the magic of converting a string to a new numeric variable, >deleting the old string variable, and then renaming the string >variable to the original variable name is done internally and not >through syntax. And that's pretty much how you would have to do it >yourself via syntax. The Data editor generally doesn't do all its >functions via syntax because it has more intimate knowledge of the >active file. Alas. Because, given that it can be done at all, there could be a syntax command (ChangeType) to do it. It's not too excruciatingly hard to do it through syntax *EXCEPT* for getting the new variable back into the original variable's place in the file. For that, there's nothing but Python. |
ADD FILES can be used to specify the order of variables:
ADD FILES FILE = * /keep var1 to varx vary all. Where vary is the renamed variable and varx is the variable just before it. But yes, this is excruiatingly fussy, if not exactly hard. --jim -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Richard Ristow Sent: Monday, January 22, 2007 2:28 PM To: [hidden email] Subject: Re: Is this an SPSS Error? At 12:07 PM 1/22/2007, Beadle, ViAnn wrote: >Because the magic of converting a string to a new numeric variable, >deleting the old string variable, and then renaming the string variable >to the original variable name is done internally and not through >syntax. And that's pretty much how you would have to do it yourself via >syntax. The Data editor generally doesn't do all its functions via >syntax because it has more intimate knowledge of the active file. Alas. Because, given that it can be done at all, there could be a syntax command (ChangeType) to do it. It's not too excruciatingly hard to do it through syntax *EXCEPT* for getting the new variable back into the original variable's place in the file. For that, there's nothing but Python. |
Free forum by Nabble | Edit this page |