Default string length when reading strings from a text file

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

Default string length when reading strings from a text file

Frank Furter
When I read string data into SPSS from a delimited text file (GET DATA / TYPE=TXT ...) I may specify the width of a string variable (e.g., "myvar a16"), or I may omit the width (e.g., "myvar a"). In the latter case the width of the string variable generated in the SPSS data file defaults to 255 characters (SPSS 18 on a Windows PC).

Is it possible to set the default to something other than 255 - e.g., for reading strings with an unknown width which may, however, be larger than 255?
Reply | Threaded
Open this post in threaded view
|

Re: Default string length when reading strings from a text file

Jon K Peck
You can't change the default string variable width for GET DATA, but you can use a simple macro to eliminate the extra keystrokes.
For example,

define !a () a2000 !enddefine.
get data /type=txt
/file = "c:/temp/simple.txt"
/delimiters = " "
 /variables = a !a b !a c !a.

HTH,

Jon Peck
Senior Software Engineer, IBM
[hidden email]
312-651-3435




From:        Andreas Voelp <[hidden email]>
To:        [hidden email]
Date:        11/13/2010 10:59 AM
Subject:        [SPSSX-L] Default string length when reading strings from a text              file
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




When I read string data into SPSS from a delimited text file (GET DATA /
TYPE=TXT ...) I may specify the width of a string variable (e.g., "myvar
a16"), or I may omit the width (e.g., "myvar a"). In the latter case the
width of the string variable generated in the SPSS data file defaults to 255
characters (SPSS 18 on a Windows PC).

Is it possible to set the default to something other than 255 - e.g., for
reading strings with an unknown width which may, however, be larger than
255?
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Default-string-length-when-reading-strings-from-a-text-file-tp3263757p3263757.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