09-19-2012 12:01 PM
Greetings. I'm trying to create a dataset in work from another dataset where a date in the source table is greater than or equeal to an input parameter, and less than or equal to another input parameter. I've tried putting it in quotes, using a period after them, and then both of those, and neither of these, and I can't get it to work. I worked on a macro this week where the only way I could get a variable to resolve was to put double quotes around it. And it seems sometimes I need to put a period after a variable and sometimes not. I'm haveing a terrible time trying to find a general rule of thumb for using variables. This is what I am trying, and I sure would appreciate any tips. Thank you.
%Let dt_start = 2012-09-01;
%Let dt_end = 2012-09-30;
if dt_bill >= &dt_start.;
if dt_bill <= &dt_stop.;
This is the error...
1817 %Let dt_start = 2012-09-01;
1818 %Let dt_end = 2012-09-30;
1819 data work.new_recs;
1820 set main.otbr_master;
1821 if dt_bill >= &dt_start.;
1822 if dt_bill <= &dt_stop.;
WARNING: Apparent symbolic reference DT_STOP not resolved.
ERROR 390-185: Expecting an relational or arithmetic operator.
ERROR 200-322: The symbol is not recognized and will be ignored.
09-19-2012 02:33 PM
Tom, the only reason it is in text format is because that is how it is stored on the mainframe. This goes back to something you helped me with last week. If i'm pulling in data from a mainframe file like so...
FILENAME ezt "PPPCTK.ZZZ.BALANCED.REVXREC.DSKO745(-&i)" DISP=SHR;
@1 ID_BA PD6.
@7 CD_BUS $4.
@16 DT_BILL $10. <<<---- I need this to end up as a date in the dataset.
@48 AT_SVC_UNIT_BILLED PD6.2
@100 CD_RATE $3.
@138 CD_REV_SRC $2.
@154 CD_CYCLE IB2.
@201 FL_MORE_REV_REC $1.;
How can I make the field 'dt_bill' be in date format. I am eventually putting this data into Excel, and '2012-09-01' does not convert to a date format in Excel, so I need it to be in a format like '9/1/2012', or anything Excel will recognize as a date. Thank you.
09-19-2012 02:36 PM
I think this will work...
input dt_bill $10.;
bill_dt = input(dt_bill,yymmdd10.);
format bill_dt mmddyy10.;
09-19-2012 02:46 PM
You could change the input format in the step that is reading the text file so that it reads it as a date instead of a character string.
... @16 DT_BILL mmddyy10.
I have to trouble with excel automatically reading YYYY-MM-DD or YYYY/MM/DD strings as dates.
Need further help from the community? Please ask a new question.