12-02-2015 03:17 PM
So I need to send a create a ODS TAGSETS.EXCELXP with no headers, as it has to line up with an excel spreadsheet that has been manually created. Any thoughts on this? The closest I've gotten has been:
DATA TEMP.EXAMPLE_OUT (DROP=RECORD) ; (Previous information brought in)
ARRAY COL $80 COL1-COL80;
INFILE "&EXAMPLE.OUT" TRUNCOVER ; (Previously called in macro variable)
INPUT @ 01 Record $CHAR500.;
COL = SUBSTR(Record,1,80);
IF INDEX(Record,"|") GE 1
DO LOOP = 1 TO 80;
COL[LOOP] = SCAN(Record,LOOP,"|");
PROC EXPORT DATA= EXAMPLE_OUT
This pulls the information into the spreadsheet that has been previously created, but with lots of issues, i.e Marcos not working, permissions, ect. This is unfortunately an excel multisheet that pulls information from bloomberg (financial) and was created years ago and i don't have the time or understanding of the financial side to make a new version of the spreadsheet and would like my output to load into the preexisting one with no error, or boxes to click, as it will need to be fully automated. Any help is appreciated
12-02-2015 03:23 PM
12-02-2015 10:13 PM
12-03-2015 04:55 AM
First and foremost, please dont code all in upper case, without prpoer indentation, it makes reading the code so much harder.
Secondly, at no point here are you creating a excelxp style tagset output file?
Thirdly, the filename given in the code - spread.xlsb.xls - doesn't seem to make much sense, are you creating:
- an XLS file which is a binary file standard strcuture pre-open office
- an XLSB file which is an open office binary component (i.e macro enabled) document
- an XLSX which is an open office standard Excel file
- or an ods tagset generated XML document which Excel can read
Finally, if your stuck with an Excel file which you need to add data into (and if so your going to end up fighting it for the rest of its existence) then why not switch the thinking around. I.e. You have some data in SAS, you need to load it into Excel. So, export the data from SAS as CSV - simple step. Now in the Excel (or another one, it only needs to hold some code) wriet a small VBA macro which allows you to select a file, opens that file into a new sheet, copies the data over as you want, then deletes the new sheet. Simple, this keeps the Excel file the same as it was, just uses Excel VBA to update. And if your stuck using Excel, why not use its full potential. Lots of examples of how to do this:
I would not suggest using DDE, its old and may not be supported, plus only has the functionality of the version all the way back then.