CONTENTS DELETED
The author has deleted this message.
|
This is a little tricky as your program is going from the syntax window, which is in utf-16 through the Statistics backend, which could be in Unicode utf-8 mode or in code page mode and on to the Python interpreter. And Python 2.x expects ascii input unless another encoding is declared in the first two line of the Python code. This is the darkest corner of Python 2 (fortunately cleaned up in Python 3, but that won't help you right now.) For starters, be sure that Statistics is in Unicode mode. I probably won't have time to sort this out until tomorrow. Also, what version of Statistics are you using? On Fri, Jan 15, 2016 at 12:37 AM, Alex Huang <[hidden email]> wrote: Dear List, |
In reply to this post by Alex Huang
You should be letting Statistics handle the encoding conversion. Assuming Unicode mode, this will work unless, perhaps, you have a very old version of Statistics. All I did was to declare the literal as a Unicode string and remove the encoding call. BEGIN PROGRAM. import spss import codecs exist = 0 for i in range(spss.GetVariableCount()): name=spss.GetVariableName(i) if name == "age2_18plus": exist = 1 if (exist): spss.Submit( u"""VALUE LABELS age2_18plus -99 '拒絕回答' 1 '18-19歲' 2 '20-24歲' 3 '25-29歲' 4 '30-34歲' 5 '35-39歲' 6 '40-44歲' 7 '45-49歲' 8 '50-54歲' 9 '55-59歲' 10 '60-64歲' 11 '65-69歲' 12 '70歲或以上'/ .""") END PROGRAM. On Fri, Jan 15, 2016 at 12:37 AM, Alex Huang <[hidden email]> wrote: Dear List, |
CONTENTS DELETED
The author has deleted this message.
|
Free forum by Nabble | Edit this page |