Microsoft Integration with SAS

Using SAS with Microsoft Azure and Microsoft applications
BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I want to transfer values, with DDE, from a SAS table to a formatted Excel worksheet. I want to do some new formatting with code.

My values are transferred, but the format doesn't change.

Shouldn't the existing format be overwritten with the new format I am coding, or do I first have to use DELETE.FORMAT?

Current area: A1:E20.

My formatting code:

put '[select("r1c1:r20c5")]';
put '[alignment(4)]'; /* Meant to be right justified. */
put '[format.number("#,##0")]';

I also tried with put '[delete.format]';, placed before the second code line above. I didn't work either.

Any suggestions?

Susan
3 REPLIES 3
data_null__
Jade | Level 19
I copied your statements to my "write with DDE and do formatting" test program and it work as I expected. If my numbers are less that 1000 nothing looks different except there are no decimal places printed.

You can confirm the function by examination of the menu Format Cells>Number

I don't think delete.format does what you what. If you want to remove formatting from cell(s) use CLEAR(2)
deleted_user
Not applicable
With put '[format.number("#,##0")]'; I was expecting to have the value 12798 shown as 12 798. Instead I got 12798,0. (I'm living in Europe, I want an empty space between 2 and 7.)

If I do it manually in an Excel sheet and record a macro, then the macro text contains the format "#,##0".

And the alignment(4) didn't have any effect. I can't understand what's wrong!

Another problem: If I have transferred 0 (zero) to cells that I want empty( I have reasons to do like that) and then want blank signs in those cells I tried with

put '[select("r1c1:r1c5")]';
put ' ' ;

It didn't work. How can it be done?

In an another, earlier answer you had some code with "link command" twice, which was for starting Excel. It shouldn't be necessary to start Excel more than once, or have missed something fundamental?

Susan
data_null__
Jade | Level 19
> With put '[format.number("#,##0")]'; I was
> expecting to have the value 12798 shown as
> 12 798. Instead I got 12798,0. (I'm
> living in Europe, I want an empty space between 2 and
> 7.)

I used this to produce the format you want.
put '[format.number("# ##0")]';

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Discussion stats
  • 3 replies
  • 1120 views
  • 0 likes
  • 2 in conversation