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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3613 views
  • 0 likes
  • 3 in conversation