BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
asimraja
Fluorite | Level 6

Hi,

 

My code creates an XML based Excel file using ODS. I'd like to format the numeric fields using the format "COMMAw.d". For example,

25431.23 would appear as 25,431.23, if I use the format comma10.2.

 

I tried various combinations (latest attempt in red font below) but can't seem to figure out. Can you please guide me?

 

Thank you in advance!

Asim

----------------------------------------------------------------------------------

 ods tagsets.excelxp file="&base_dir_path./Output/&booking_month./MapBook/&exportname..xls" style=normal;

    ods tagsets.excelxp options(sheet_name="Error-Higher Balance");
    PROC PRINT DATA=higher_balance noobs;
        var SECU_CUSIP_ID / style={TAGATTR='format:text'};
        var issuer_sector;
        var IPIECE_CURR_UPB_AMT upb_old change_in_balance / style = {TAGATTR='format#,##0:numeric'};
    RUN;

 

ods tagsets.excelxp close;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
For XML you need to use Excel format, not SAS formats. Try the followinf without numeric.

format:###,####,##0.00

View solution in original post

4 REPLIES 4
ballardw
Super User

I'm not seeing any place you are using the commaw.d format.

 

Did you try?

 

format IPIECE_CURR_UPB_AMT upb_old change_in_balance comma10.2;

asimraja
Fluorite | Level 6
Ballardw,
My apologies that I didn't explain my dilemma clearly. I didn't want to use comma w.d format, as I knew that I had to use an Excel format. I referred to comma w.d format to explain that I want the end result the same as if I'd use w.d format.
Reeza
Super User
For XML you need to use Excel format, not SAS formats. Try the followinf without numeric.

format:###,####,##0.00
asimraja
Fluorite | Level 6
Reeza,
Thank you for the solution! It worked. 🙂
Regards,
Asim

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 4149 views
  • 0 likes
  • 3 in conversation