08-13-2014 06:04 PM
Greetings again all!
I'm using the ODS Tagset ExcelXP and ProcPrint multiple tables to multiple sheets in excel (well first to XML then Excel). My problem is that when my dataset comes back blank no sheet is written, and my work book is considerably smaller. To fix this problem I use the following MACRO (thnx SAS forum!):
%macro IFz1(data=&syslast) /des= 'if Zero make 1 obs' ;
data &data ;
if nobs then stop ;
modify &data nobs=nobs ;
This inserts one observation when there are no observations. The problem is that it can't add an observation when a date is involved; example:
CREATE TABLE foo AS
date1 format mmddyy11. AS date2,
%IFz1 will then run but come back with ERROR: Width specified for format MMDDYY is invalid, when I comment out the "format mmddyy11." it works fine and inserts a blank observation. I believe that my column "date1" in my example is a DateTime data type. If I change the format to mmddyyyy the column says: "5at1946" and is a "custom" data type in excel.
Has anyone encountered this before, and is there a work around? I would love to know!
Loving the SAS community so far, I hope to contribute at some point
08-13-2014 06:28 PM
If you check out the documentation:
You will see that the maximum length for the mmddyy format is 10, hence the error you are getting. Also specify a format in SQL like so: select date1 format = mmddyy10. as date2
Need further help from the community? Please ask a new question.