SAS FORMAT output to Excel

Reply
Occasional Contributor
Posts: 9

SAS FORMAT output to Excel

I am trying to output using PROC EXPORT County Names to Excel but only seems to work for CSV output.

So if RESCODE = 001 then County_NAME should output as ALAMEDA.

 

COUNTY_NAME = RESCODE;
FORMAT COUNTY_NAME $RESCODE.;

 

It appears that XLSX output is not using the formatted variable but the original RESCODE. 

So PROC EXPORT for dbms=XLSX I get 001 for dbms=CSV I get ALAMEDA.

 

Is this a bug in the EXCEL export?

Super User
Posts: 17,828

Re: SAS FORMAT output to Excel

Post your log from the PROC EXPORT.

 

You can use ODS EXCEL to get around this.

Super User
Posts: 10,500

Re: SAS FORMAT output to Excel

Not a bug but very intentional behavior. Proc EXPORT is used for data value interchange. If you want proc export to send a value to a destination then it needs to be the value of the variable.

 

You can use Proc Print with an ODS destination such as Excel or tagsets.excelxp and specify the format to use when printing the values.

Ask a Question
Discussion stats
  • 2 replies
  • 211 views
  • 0 likes
  • 3 in conversation