BookmarkSubscribeRSS Feed
gstullo
Obsidian | Level 7

Hi,

I am using the following to reformat some data from 9999 to 163-KN9-999:

proc format;

  picture KH_Format

  low-high='9-999'

  (prefix='163-KH');

run;

This gives me exactly what I need and the variables look great when I export to .csv.  Problem is that I need to export to .xlsx and the format does not "stick."  In the .xlsx file the formats go back to only a 4 digit rather than the desired 163-KH9-999.

Any thoughts on why this is or ideas on another method that will not cause problems?

Thank!

G

3 REPLIES 3
AncaTilea
Pyrite | Level 9

You could try the

ODS TAGSETS.EXCELXP and PROC PRINT

Anca.

Reeza
Super User

In the log SAS tells you that exporting to Excel will not maintain formats.

You have two options:

1) create a new variable and recode the variable using a put statement and output that variable instead.

2) Output using another destination, principally, tagsets.excelxp that will maintain the format.

data_null__
Jade | Level 19

I think you will need to create a character version of the variable and export it insead of the numeric.

put(x,KH_FORMAT.)

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 910 views
  • 0 likes
  • 4 in conversation