I have a user asking to reformat a $ value when it is a credit it is showing as $-1,175.55 user wants ($1,175.55)
I am using :
style(column)= [tagattr='format:$#,###,##0.00']; = $-1,175.55
The users want the value to look like ($1,175.55)
Is there a tagattr style that will give me that?
Thanks,
Elliott
@Elliott wrote:
unfortunately I was not able to get this to work.
Thanks,
Elliott
Doesn't work is awful vague.
Are there errors in the log?: Post the code and log in a code box opened with the "</>" to maintain formatting of error messages.
No output? Post any log in a code box.
Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "</>" icon or attached as text to show exactly what you have and that we can test code against.
Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.
Hi Reeza,
Unfortunately, this did not work. I am outputting to excel and we are processing on a linux server.
Thank you for the link, that was very helpful.
is there anything else to try?
Thanks,
Elliott
Processing what on Linux? The EXCEL file? or the SAS program that is writing the EXCEL file?
Setting the format works for me:
missing d;
data test;
input id amount ;
cards;
1 1234.56
2 -1234.56
3 0
4 D
;
ods excel file='c:\downloads\credit.xlsx';
proc print data=test;
id id;
var amount / style(data)=[tagattr='format:$#,###,##0.00;($#,###,##0.00);"-";[Red]@'] ;
run;
ods excel close;
Hi Tom,
Processing on Linux creating an excel output.
I tried your suggestion but it did not give the desired result.
Thanks,
Elliott
I am not Johnny Carson.
Please share an example of code that does not work.
Explain what about it does not work.
You did not include the extra values in the Excel format so that it Excel would know you wanted the negative values formatted differently.
var Cur_Bal
/ style(Column)= [tagattr='format:$#,###,##0.00;($#,###,##0.00)']
;
Also, you are not making a real Excel file. You are making an XML file. To write an actual XLSX file use ODS EXCEL instead of the EXCELXP tagset.
unfortunately I was not able to get this to work.
Thanks,
Elliott
@Elliott wrote:
unfortunately I was not able to get this to work.
Thanks,
Elliott
Doesn't work is awful vague.
Are there errors in the log?: Post the code and log in a code box opened with the "</>" to maintain formatting of error messages.
No output? Post any log in a code box.
Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "</>" icon or attached as text to show exactly what you have and that we can test code against.
Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.
Thank you, I have achieved the desired result.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.