August 04, 2005, 03:42 PM
slfmrDATE in QUOTE
I have a Date that I want to be put in quotes through the use of a Define.
Generally this is what I have:
DEFINE FILE HOLDMAIN
CTR/I9 = LAST CTR + 1;
CONDITIONAL/A5 = IF CTR EQ 1 THEN '' ELSE 'OR';
STATUS/A8 = EVENT_STATUS;
DATE/HYYMDS = EVENT_EFF_DATE;
CODE/A8 = EVENT_CODE;
END
BUT when I put them in single quotes I use this:
DEFINE FILE HOLDMAIN
CTR/I9 = LAST CTR + 1;
CONDITIONAL/A5 = IF CTR EQ 1 THEN '' ELSE 'OR';
STATUS/A8 = '''' || EVENT_STATUS || '''';
DATE/HYYMDS = '''' || EVENT_EFF_DATE || '''';
CODE/A8 = '''' || EVENT_CODE || '''';
END
Everything works fine EXCEPT the Date. All I want to do is display it in single quotes.
TABLE FILE HOLDMAIN
PRINT
CONDITIONAL
DATE
END
Which would look like this:
CONDITIONAL DATE
(BLANK) '01/01/2005'
OR '01/02/2005'
Does this make sense?
Thanks for your help!
August 04, 2005, 04:35 PM
Francis MarianiTry this. You have to convert the HYYMDS date to alpha to append anything to it:
DEFINE FILE CAR
DATE1/HYYMDS = HINPUT(8, '20050523', 8, 'HYYMDS');
DATE2/A22 = '''' || HCNVRT(DATE1,'(HYYMDS)',20,'A20') || '''';
END
TABLE FILE CAR
PRINT
CAR
DATE1
DATE2
BY COUNTRY
END
August 04, 2005, 06:07 PM
slfmrThat worked!! Thanks so much... the only one I used was the HCNVRT, but I had never seen that function so would never have thought of it.
Thanks a million again.