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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

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