Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
Sebnem
Level II

script/formula _add a comment in a new column after a certain date

Hello,

 

I have a table (attached) and created column "condition". I want this column to say "before" or "after"  based on the date stated in

varProcessChange. I can't make it work correctly. Can you pleas see what Is missing?

 

varProcessChange = Date MDY( 09, 1, 2020 );

Eval(
Eval Expr(
colCondition = dt1 << New Column( “Condition”,
character,
nominal,
formula( If( :name( "MonthYear" ) < Expr( varProcessChange ), "Before", "After" ) )
)
)
);

 

thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: script/formula _add a comment in a new column after a certain date

I think this is the best way to handle your issue

Names Default To Here( 1 );
dt1=current data table();
varProcessChange = Date MDY( 09, 1, 2020 );

Eval(
	Substitute(
			Expr(
				colCondition = dt1 << New Column( “Condition”,
					character,
					nominal,
					formula(
						If( :name( "MonthYear" ) < __vpc__,
							"Before",
							"After"
						)
					)
				);
			),
		Expr( __vpc__ ), varProcessChange
	)
);
Jim

View solution in original post

1 REPLY 1
Highlighted
txnelson
Super User

Re: script/formula _add a comment in a new column after a certain date

I think this is the best way to handle your issue

Names Default To Here( 1 );
dt1=current data table();
varProcessChange = Date MDY( 09, 1, 2020 );

Eval(
	Substitute(
			Expr(
				colCondition = dt1 << New Column( “Condition”,
					character,
					nominal,
					formula(
						If( :name( "MonthYear" ) < __vpc__,
							"Before",
							"After"
						)
					)
				);
			),
		Expr( __vpc__ ), varProcessChange
	)
);
Jim

View solution in original post

Article Labels