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

NOTE: This is the Excel XP tagset (Compatible with SAS 9.1.3 and above, v1.131, 04/23/2015

Reeza
Super User

@JasonNC This is the latest version of the tagset. As mentioned I tested my code on SAS 9.4 with the latest tagset and correct format it works as desired. 

Finding the correct format is an Excel, not SAS issue, but Google still functions. 

 

http://www.techrepublic.com/blog/microsoft-office/use-a-custom-format-in-excel-to-display-easier-to-...

 

Good Luck.

Reeza
Super User

1. Please review the code Cynthia provided in comparison to yours. You haven't specified your style for the column, have extra quotation marks, and have quotations in the wrong place. 

3. You also need to specify a SAS format so that it's exported in the format you want. In your code there is no format. 

 

Making these changes, with the latest version of tagsets generates exactly what you state you want. 

 

Data Dolr_test;
    format dolrs 15.2;
    input Agent $ Dolrs;
    datalines;
George 31918175.55
Adam 9013533.98
Danny 59407.72
;
run;

ods tagsets.excelxp file="/folders/myfolders/sample_out.xml" style=meadow;

proc report data=Dolr_test split='*';
    column Agent Dolrs;
    define Agent/ order order=data;
    define Dolrs / " $ Dollars * (000)" FORMAT=15.2 style={tagattr="format:[$$-409]#,##0"};
run;

ods tagsets.excelxp close;

 

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes, typo on my part here.  The equals should be a colon:

Data Dolr_test;
  input Agent $ Dolrs 15.2;
datalines;
George 31918175.55
Adam 9013533.98
Danny 59407.72
;
run;
 
ods tagsets.excelxp file = "s:\temp\rob\Dolr_test.xml" ;
proc report data=Dolr_test split='*' ;
  column Agent Dolrs;
  define Agent/ order order=data;
  define Dolrs / " $ Dollars * (000)" style={tagattr="Format:[$$-409]#,##0"};
run;
ods tagsets.excelxp close;
JasonNC
Quartz | Level 8

Thank you Reeza,RW9 & Cyntia for your patience and support.Sorry for getting back late

It worked and in the format the only modification was adding comma after the 0 in the format which worked.

 

style={tagattr="Format:[$$-409]#,##0,"}

  

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 19 replies
  • 2306 views
  • 4 likes
  • 4 in conversation