Consistency of Casing in Syntax Python is another reason

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Consistency of Casing in Syntax Python is another reason

Art Kendall
It appears that variable name strings{myVar myvar Myvar and MyVar} are not the same same as each
in Python.

I have long suggested that SPSS develop Python or something that would pull the variables names from a set of SPSS syntax files, check whether names were the same except for casing and when there were mismatches ask the user which casing (s)he would like throughout the set of files.

I was advocating this for reasons of making syntax readable when it is to be shared.  Now there is another reason to clean up syntax.
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Consistency of Casing in Syntax Python is another reason

Jon K Peck
Python is a case-sensitive language, so in many situations that is respected although it is different from Statistics behavior.  While there is no conversion utility for variable names, if you run the GATHERMD extension command (File > Collect Variable Information) for a set of data files, it produces a dataset listing all the names as they are cased in the files along with source and label .  So sorting that by the variable name will show you any casing mismatches.  Fixing them would be up to you.  It would be possible to write Python code driven off this dataset to make the changes, but the conversion rules would need to be worked out.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Art Kendall <[hidden email]>
To:        [hidden email]
Date:        09/03/2014 09:22 AM
Subject:        [SPSSX-L] Consistency of Casing in Syntax  Python is another reason
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




It appears that variable name strings{myVar myvar Myvar and MyVar} are not
the same same as each
in Python.

I have long suggested that SPSS develop Python or something that would pull
the variables names from a set of SPSS syntax files, check whether names
were the same except for casing and when there were mismatches ask the user
which casing (s)he would like throughout the set of files.

I was advocating this for reasons of making syntax readable when it is to be
shared.  Now there is another reason to clean up syntax.



-----
Art Kendall
Social Research Consultants
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Consistency-of-Casing-in-Syntax-Python-is-another-reason-tp5727142.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


===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Consistency of Casing in Syntax Python is another reason

Art Kendall
That is basically what I have done between .sav files.

I would like to be able to have consistency of casing within .sps files.

The process I envision would take the variable names from the .sav file resulting from the syntax.
It would then find variations on the casing of variable names in the .sps file.
A dialog could then ask which was the preferred casing.

Alternatively,
a dialog would take the list of names from the .sav file and ask the user if the casing is what was desired.
The user would then edit the list and paste it back in.  The dialog would then edit the .sps file to make the casings consistent.

I am interested in maximizing readability of syntax by people.




Art Kendall
Social Research Consultants