I am calculating the value for a new variable, and then have the command
FORMATS FTES (F8.2). But when I save the outfile, the full precision value is happening and I need it to just use the format specified. When the value has more than 2 decimal places, it will bomb when the file is loaded into another system. I need a tab delimited file. SAVE TRANSLATE OUTFILE='coursedata.dat' /TYPE=TAB. What am I doing wrong? |
SAVE TRANSLATE OUTFILE='coursedata.dat'
/TYPE=TAB /FORMAT=VARIABLE. Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: Laurie Pemberton <[hidden email]> To: [hidden email], Date: 06/30/2014 02:00 PM Subject: Saved outfile is not keeping formats of values Sent by: "SPSSX(r) Discussion" <[hidden email]> I am calculating the value for a new variable, and then have the command FORMATS FTES (F8.2). But when I save the outfile, the full precision value is happening and I need it to just use the format specified. When the value has more than 2 decimal places, it will bomb when the file is loaded into another system. I need a tab delimited file. SAVE TRANSLATE OUTFILE='coursedata.dat' /TYPE=TAB. What am I doing wrong? -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Saved-outfile-is-not-keeping-formats-of-values-tp5726620.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 |
Administrator
|
In reply to this post by Laurie Pemberton
FORMATS is just affecting the display format, not the actual values. It ~sounds~ as if you want to do something like this instead:
COMPUTE FTES = rnd(FTES, .01). Look up the RND function in the FM for more info.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by Laurie Pemberton
formatS is used to set both display and write formats. You could (but why would you; I never do this) set these separately. I do believe that this affects the precision in eg .csv. But you are right that in the .sav the values are still stored as floats.
------------------------------ On Mon, Jun 30, 2014 9:09 PM CEST Bruce Weaver wrote: >FORMATS is just affecting the display format, not the actual values. It >~sounds~ as if you want to do something like this instead: > >COMPUTE FTES = rnd(FTES, .01). > >Look up the RND function in the FM for more info. > > > >Laurie Pemberton wrote >> I am calculating the value for a new variable, and then have the command >> FORMATS FTES (F8.2). >> >> But when I save the outfile, the full precision value is happening and I >> need it to just use the format specified. When the value has more than 2 >> decimal places, it will bomb when the file is loaded into another system. >> I need a tab delimited file. >> SAVE TRANSLATE OUTFILE='coursedata.dat' >> /TYPE=TAB. >> >> What am I doing wrong? > > > > > >----- >-- >Bruce Weaver >[hidden email] >http://sites.google.com/a/lakeheadu.ca/bweaver/ > >"When all else fails, RTFM." > >NOTE: My Hotmail account is not monitored regularly. >To send me an e-mail, please use the address shown above. > >-- >View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Saved-outfile-is-not-keeping-formats-of-values-tp5726620p5726622.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 |
The correct solution is this:
save translate /outfile='filename.tab' /type=tab /textoptions format=variable. Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: Albert-Jan Roskam <[hidden email]> To: [hidden email], Date: 06/30/2014 05:23 PM Subject: Re: Saved outfile is not keeping formats of values Sent by: "SPSSX(r) Discussion" <[hidden email]> formatS is used to set both display and write formats. You could (but why would you; I never do this) set these separately. I do believe that this affects the precision in eg .csv. But you are right that in the .sav the values are still stored as floats. ------------------------------ On Mon, Jun 30, 2014 9:09 PM CEST Bruce Weaver wrote: >FORMATS is just affecting the display format, not the actual values. It >~sounds~ as if you want to do something like this instead: > >COMPUTE FTES = rnd(FTES, .01). > >Look up the RND function in the FM for more info. > > > >Laurie Pemberton wrote >> I am calculating the value for a new variable, and then have the command >> FORMATS FTES (F8.2). >> >> But when I save the outfile, the full precision value is happening and I >> need it to just use the format specified. When the value has more than 2 >> decimal places, it will bomb when the file is loaded into another system. >> I need a tab delimited file. >> SAVE TRANSLATE OUTFILE='coursedata.dat' >> /TYPE=TAB. >> >> What am I doing wrong? > > > > > >----- >-- >Bruce Weaver >[hidden email] >http://sites.google.com/a/lakeheadu.ca/bweaver/ > >"When all else fails, RTFM." > >NOTE: My Hotmail account is not monitored regularly. >To send me an e-mail, please use the address shown above. > >-- >View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Saved-outfile-is-not-keeping-formats-of-values-tp5726620p5726622.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 ===================== 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 |
Free forum by Nabble | Edit this page |