Hi,
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[1] = SUBSTR(Record,1,80);
IF INDEX(Record,"|") GE 1
THEN DO;
DO LOOP = 1 TO 80;
COL[LOOP] = SCAN(Record,LOOP,"|");
END;
END;
RUN;
PROC EXPORT DATA= EXAMPLE_OUT
OUTFILE= "C:\SPREAD.xlsb.xls"
DBMS=xls REPLACE;
PUTNAMES=NO;
SHEET="INFO";
RUN;
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
Hi,
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:
http://www.zerrtech.com/content/excel-vba-open-csv-file-and-import
https://msdn.microsoft.com/en-us/library/office/ff840655.aspx
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.