I’m having some trouble with the DOLLAR format command. Or maybe it’s an
issue with the TABLES command. My data begins life as text. For example $3255 would be represented as 00325500 with an implied decimal point. I have used recode e384(convert) into AmtChd to change the text value into a numeric value (00325500 becomes 325500.0) and I further divide that amount by 100. compute AmtChd = AmtChd / 100. which leaves AmtChd as 3255.00. I have a need to aggregate the data, and one of the sub-commands in the aggregate is /AmtChd = sum(AmtChd) which I don’t think will do any harm. Then I run a TABLES command. The Tables command works just fine, but the format wasn’t so pretty. I introduced a format command thinking it would provide a $ sign and some commas. formats AmtChd Debt Paid LoanFee (dollar15.2). Well it did, almost. The Table output is displayed in the list file (ie. IBM SPSS Statistics Viewer), and that’s where the issue arises. If I run the code for a single person I get the following output from the Tables command. There is a $ sign exactly where I would expect one. I'm happy. flag 1.00 1 .250 $6,510.00 $6,510.00 $0.00 $1,627.50 which is good. If I then include all my data I get the following: flag 1.00 108 49.375 $1176075.00 $1171513.00 $2,820.00 $292,878.25 Some commas have been dropped. But here’s the interesting part. If I copy the same table output and paste into a Word document I get the following: flag 1.00 108 49.375 $1,176,075.00 $1,171,513.00 $2,820.00 $292,878.25 I'd rather not have to use Word to view my Tables output. I'd rather see the output in the list file all neatly formatted with a $ sign and a few commas. Any ideas? -- Sent from: http://spssx-discussion.1045642.n5.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 |
Try increasing the defined width. If the formatted value is to wide for the defined width, the application will try to make the value fit by first dropping formatting characters (e.g. commas) and then rounding decimals. On Wed, Oct 10, 2018, 11:30 PM Ron0z <[hidden email]> wrote: I’m having some trouble with the DOLLAR format command. Or maybe it’s an |
That was my original idea too because I'd seen similar effects with other
format issues. I changed it to *formats AmtChd Debt Paid LoanFee (dollar20.2)* with no effect. Curiously, though the following *formats AmtChd Debt Paid LoanFee (comma10.2).* produces the this format. It correctly shows commas in the correct places. flag 1.00 108 49.375 1,176,075.00 1,171,513.00 2,820.00 292,878.25 Perhaps DOLLAR is not as versatile as COMMA, but that would be surprising. -- Sent from: http://spssx-discussion.1045642.n5.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 |
CTABLES should pick up the variable format, but have you tried setting it explicitly in the command. e.g.,: (debt[S][MEAN DOLLAR40.2] On Thu, Oct 11, 2018 at 4:05 PM Ron0z <[hidden email]> wrote: That was my original idea too because I'd seen similar effects with other |
I'd never thought of that Jon, but it didn't work. I'm beginning to wonder if
the issue is related to my installation or a limitation of the SPSS list file, because when I was copying the Tables output to the forum to demonstrate its failure the pasted copy was perfect! <http://spssx-discussion.1045642.n5.nabble.com/file/t340795/Capture.png> So at this point, if I use SPSS copy special and copy Plain Text I get the following in the summary line: flag 1.00 108 49.375 $1,176,075.00 $1,171,513.00 $2,820.00 $292,878.25 It would seem that SPSS has done the formatting but its just not showing in the list file output. Let me try what Jon suggested. <http://spssx-discussion.1045642.n5.nabble.com/file/t340795/Capture2.png> And just to confirm, I'll copy the summary line as Plain Text again: flag 1.00 108 49.375 $1,176,075.00 $1,171,513.00 $2,820.00 $292,878.25 My use of this report is for my personal verification of funding amounts. No one will see it but me. I can cope with COMMA format which does work well. I can live without a $ sign. However, should I ever have to produce a report for management it would be unfortunate if I can't show the $ signs consistently. -- Sent from: http://spssx-discussion.1045642.n5.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 |
In reply to this post by Jon Peck
A snippet of the code I've been using.
SPSS_Dollar_Format_issue.zip <http://spssx-discussion.1045642.n5.nabble.com/file/t340795/SPSS_Dollar_Format_issue.zip> The file path will need to be edited when extracted from the zip file, and hopefully a clean copy is available in the link. -- Sent from: http://spssx-discussion.1045642.n5.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 |
Got it. The problem is that the CTABLES MAXCOLWIDTH setting is too small. Here's an example that works. CTABLES /VLABELS VARIABLES=AmtChd DISPLAY=DEFAULT /format maxcolwidth=20 units=cm /TABLE AmtChd [S][SUM DOLLAR40.2]. Note that the max width here is set in terms of the units measure, not the number of characters, which is what formats use. On Thu, Oct 11, 2018 at 8:00 PM Ron0z <[hidden email]> wrote: A snippet of the code I've been using. |
That does it! Thank you. And I spotted the section in the Tables dialogue
that I need to go. It was in a place I never usually go: Options > Width for Data Columns and setting Custom then entering suitable values as you suggested. Much obliged. -- Sent from: http://spssx-discussion.1045642.n5.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 |
Free forum by Nabble | Edit this page |