<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: dollarw.d formatting in data _null_ with negative numbers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392087#M94270</link>
    <description>&lt;P&gt;Open the CSV file in Notepad, not Excel.&lt;/P&gt;
&lt;P&gt;*Never* check raw data in Excel.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2017 05:01:51 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2017-08-31T05:01:51Z</dc:date>
    <item>
      <title>dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392079#M94263</link>
      <description>&lt;P&gt;SAS gurus,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I ran the below program and I am attaching output as well. But what I don't want to see is () for dollar format (for - ve money ) &amp;nbsp;in the output &amp;nbsp;.csv file. I want to see the same numbers in the output (.csv file) with dollar sign before them for example -158.57 should look like $ -158.57 or - $ 158.57 (I don't know if its a possibility). If you need further clarification, please ask.&lt;/P&gt;&lt;P&gt;Any ideas how to fix this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;input name$ money1 money2 money3;&lt;BR /&gt;cards;&lt;BR /&gt;ryan 125.12 -158.57 147.21&lt;BR /&gt;peter 128.74 584.17 354.00&lt;BR /&gt;smith -152.00 259.00 325.00&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;select count(*)&lt;BR /&gt;into :NObs&lt;BR /&gt;from work.new;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro money;&lt;BR /&gt;%if &amp;amp;nobs ne 0 %then %do;&lt;BR /&gt;data _null_;&lt;BR /&gt;file 'C:\Intel\new.csv';&lt;BR /&gt;set new;&lt;BR /&gt;format money1 money2 money3 dollar25.2;&lt;BR /&gt;if _n_=1 then do;&lt;BR /&gt;put;&lt;BR /&gt;put 'name,money1,money2,money3';&lt;BR /&gt;put;&lt;BR /&gt;end;&lt;BR /&gt;put name ',' money1 ',' money2 ',' money3;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%money;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 04:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392079#M94263</guid>
      <dc:creator>buddha_d</dc:creator>
      <dc:date>2017-08-31T04:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392083#M94267</link>
      <description>&lt;P&gt;If I open your output file new.csv in text pad. Values are written as you want.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name,money1,money2,money3

ryan ,$125.12 ,$-158.57 ,$147.21
peter ,$128.74 ,$584.17 ,$354.00
smith ,$-152.00 ,$259.00 ,$325.00&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;() is displayed in MS excel. You may have to change Cell format to view as you like&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 04:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392083#M94267</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2017-08-31T04:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392084#M94268</link>
      <description>&lt;P&gt;Rahul, Thank you for your prompt reply. I want my code to produce that (I know I could manipulate to look the way I want it to look). There must be a way to code it around. I am trying to find that out.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 04:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392084#M94268</guid>
      <dc:creator>buddha_d</dc:creator>
      <dc:date>2017-08-31T04:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392085#M94269</link>
      <description>&lt;P&gt;You should not get parentheses with the dollar format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data _null_; 
  A=-1.1; 
  putlog  A= dollar25.2  A= negparen25.2; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A=$-1.10 A=(1.10)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 05:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392085#M94269</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-08-31T05:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392087#M94270</link>
      <description>&lt;P&gt;Open the CSV file in Notepad, not Excel.&lt;/P&gt;
&lt;P&gt;*Never* check raw data in Excel.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 05:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392087#M94270</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-08-31T05:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392111#M94288</link>
      <description>&lt;P&gt;The DOLLAR format seems to do what you want. &amp;nbsp;How did you view the CSV file?&lt;/P&gt;
&lt;PRE&gt;595   data _null_;
596     file log dsd ;
597     set new ;
598     format money: dollar25.2 ;
599     put (name money:) (+0) ;
600   run;

ryan,$125.12,$-158.57,$147.21
peter,$128.74,$584.17,$354.00
smith,$-152.00,$259.00,$325.00
&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Aug 2017 06:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392111#M94288</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-08-31T06:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392126#M94298</link>
      <description>&lt;P&gt;Tom, I do see the format for the negative numbers with your code, but the numbers don't get separated in individual cells (in excel).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using excel to view it as this is the standard practice. So could you please make changes in my code and send it back to me. I would really appreciate it. Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 09:07:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392126#M94298</guid>
      <dc:creator>buddha_d</dc:creator>
      <dc:date>2017-08-31T09:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392148#M94312</link>
      <description>&lt;P&gt;What I understand, it is related to the way you see the data in excel. SAS is producing the result as desired but you need to check the cell format in excel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 11:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392148#M94312</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2017-08-31T11:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392221#M94345</link>
      <description>&lt;P&gt;A CSV file has no place to store formatting information. &amp;nbsp;You will probably need to post on a Excel forum if you want help with changing how Excel handles CSV files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you could change your SAS code to generate an Excel file directly instead.&lt;/P&gt;
&lt;P&gt;If you use ODS EXCEL and PROC PRINT to create the file they you can attach Excel formats to the variables.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 14:27:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392221#M94345</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-08-31T14:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: dollarw.d formatting in data _null_ with negative numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392323#M94379</link>
      <description>&lt;P&gt;If you must look at the data in Excel and want a $ AND no () for negative numbers you will either have create a custom Excel cell format&amp;nbsp;display as none of the Excel currency or custom formats is set to display any -$ or $-.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember that Excel comes from&amp;nbsp;an accounting background (spreadsheets existed long before computers)&amp;nbsp;and those folks have there standard displays and $ and - don't mix.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 18:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dollarw-d-formatting-in-data-null-with-negative-numbers/m-p/392323#M94379</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-31T18:46:45Z</dc:date>
    </item>
  </channel>
</rss>

