Hi all, I'm hoping someone can assist me with this - I have written some code that creates a data set where a couple of the variables are Excel formulas. What I want to be able to do is then to export the data set as an Excel file and for the formulas to be active as soon as I open the sheet. This is the part of the code that creates the Excel formula variables (the variables in question are Exchange1 and backed): - data all_sel_4_1; set datasets.all_sel_2_1_&csv_file.; length Exchange1 $ 300; horse = compress(horse,"`"); cell_1 = strip(put(_n_ + 1,best.)); cell_2 = strip(put(_n_ + 4,best.)); Exchange1 = cats("=IF(ISNA(VLOOKUP(D",cell_1,",&excel.,3,FALSE)),",'"','"',",VLOOKUP(D",cell_1,",&excel.,3,FALSE))"); backed = cats('=IF(F',cell_1,'="",0,1)'); time_run = timestamp; drop cell_1 cell_2 timestamp; run; I have little experience in using ods but if I try to create an xlsx file using this code ods excel file="/folders/myfolders/Excel/Outputs/&csv_file._Merge_2.xlsx" style=normal options(formulas='on'); proc print data=all_sel_4_1 noobs; run; ods excel close; the xlsx file is created but when I open it, the Exchange1 variable shows the full text of the formula in the cell. If I click the cell, press F2 and enter, that activates the formula (forgive me if that isn't the correct terminology). The formula for the backed variable is active as soon as I open the sheet. To get around this, I have been using ods html and creating an xls file: - ods html file="/folders/myfolders/Excel/Outputs/&csv_file._Merge_2.xls" style=normal options(formulas='on'); proc print data=all_sel_4_1 noobs; run; ods html close; This does work but when I open the file, it gives me a warning about the file format and extension not matching. I would like to be able to use ods Excel but am just not sure what I need to do differently in order to ensure that all the formulas are recognised as such when the file is opened. The only difference I can see in how the two formulas are created is around the quote marks I have used, but in the Exchange1 variable, I need to use the double quotes in order to resolve the macro variable. As always, any ideas or suggestions will be gratefully received. Thanks, Rob
... View more