Unless there is a real reason to keep the Target Date values as a character column, I suggest you convert it to a JMP Date column.
Names Default To Here( 1 );
dt = Current Data Table();
dt << new column( "Target Date", format( "ddmonyyyy") );
for each row(
if( :"Time (Months)"n <= 3,
:Target Date =
Informat( :Available Date, "ddmonyyyy" ) + In Days( 4 ),
:Target Date =
Informat( :Available Date, "ddmonyyyy" ) + In Days( 7 )
)
);
It is very easy to convert the above output to character by the below modification
Names Default To Here( 1 );
dt = Current Data Table();
dt << new column( "Target Date", character );
for each row(
if( :"Time (Months)"n <= 3,
:Target Date = format(
Informat( :Available Date, "ddmonyyyy" ) + In Days( 4 ),
"ddmonyyyy"
),
:Target Date = format(
Informat( :Available Date, "ddmonyyyy" ) + In Days( 7 ),
"ddmonyyyy"
)
)
);
If the output format needs to be exactly as the input data format is, the following will get that accomplished
Names Default To Here( 1 );
dt = Current Data Table();
dt << new column( "Target Date", character );
monthList = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP",
"OCT", "NOV", "DEC"};
for each row(
if( :"Time (Months)"n <= 3,
temp = Informat( :Available Date, "ddmonyyyy" ) + In Days( 4 ),
temp = Informat( :Available Date, "ddmonyyyy" ) + In Days( 7 )
);
:Target Date = Substr( "0", Length( Char( Day( temp ) ) ) ) ||
Char( Day( temp ) ) || "-" || monthList[Month( temp )] || "-" ||
Char( Year( temp ) );
);
If you wanted to use a formula rather than the For Each Row, this would be for formula for the above output
monthList = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
If( :"Time (Months)"n <= 3,
temp = Informat( :Available Date, "ddmonyyyy" ) + In Days( 4 ),
temp = Informat( :Available Date, "ddmonyyyy" ) + In Days( 7 )
);
Substr( "0", Length( Char( Day( temp ) ) ) ) || Char( Day( temp ) ) || "-" || monthList[Month( temp )] || "-" ||
Char( Year( temp ) );
Jim