12-20-2016 03:48 PM
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?
12-20-2016 04:08 PM
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.