Preserve variable format in DDE

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 18
Accepted Solution

Preserve variable format in DDE

[ Edited ]

I have a dataset of statistics that I wish to export to Excel. One of the numeric variables is called "pval", but it's missing everywhere because I didn't perform a statistical test. I don't want to see decimal places here in the exported table, I want to see "NA". I have a format to make missing numeric values be displayed as "NA" and it seems to work within SAS, but when I export the dataset using a DDE macro the values either appear as just "N" or simply as blank. How do I get the format to work properly when the data is exported?

 

Thank you!


Accepted Solutions
Solution
‎02-02-2016 09:07 AM
Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: Preserve variable format in DDE

My recommendation would be to not use DDE in the first place.  The technology is old, and may not be supported further.  Also it only has functionality for a very old version of Excel.  There are much better options for exporting data to Excel, which allow you to specify formats, layouts and such like.  Ods tagsets.excelxp for instance in combination with proc report is generally good enough for most scenarios, see:

http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html

http://www.lexjansen.com/pharmasug/2010/CC/CC22.pdf

 

 

View solution in original post


All Replies
Grand Advisor
Posts: 17,338

Re: Preserve variable format in DDE

What does your put statement look like? What about converting it to character in that put statement?
Solution
‎02-02-2016 09:07 AM
Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: Preserve variable format in DDE

My recommendation would be to not use DDE in the first place.  The technology is old, and may not be supported further.  Also it only has functionality for a very old version of Excel.  There are much better options for exporting data to Excel, which allow you to specify formats, layouts and such like.  Ods tagsets.excelxp for instance in combination with proc report is generally good enough for most scenarios, see:

http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html

http://www.lexjansen.com/pharmasug/2010/CC/CC22.pdf

 

 

Occasional Contributor
Posts: 18

Re: Preserve variable format in DDE

I just tried this method and it looks like it's working great! Thanks so much, this will help me out a lot.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 282 views
  • 0 likes
  • 3 in conversation