cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
hcarr01
Level VI

Formule colonne

Bonjour à tous, J’essaye de faire un script JMP permettant de calculer des durées delta. Je dispose de 847 colonnes date début, 847 colonnes date de fin. Le script ci-dessous utilise une boucle for pour calculer la nouvelle valeur de chaque colonne « durée tâche x"(colonne déjà créé ultérieurement, x allant de 1 à 847). Merci pour votre aide.

 

hcarr01_0-1682063674841.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Formule colonne

An easier way might be to use the Date Difference() function. Example below:

/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN.  BY USING THE CODE, YOU AGREE TO THESE TERMS.  YOUR USE OF THE CODE IS AT YOUR OWN RISK.  JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose.  The Code is designed to add functionality to the Software but has not necessarily been tested.  Accordingly, JMP makes no representation or warranty that the Code will operate error-free.  JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages.  Except as otherwise provided above, the Code is governed by the same agreement that governs the Software.  If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries.  ® indicates USA registration.  Other brand and product names are registered trademarks or trademarks of their respective companies.
*/

Names default to here (1);
dt = New Table( "Dates",
	Add Rows( 4 ),
	New Column( "Start Date",
		Numeric,
		"Continuous",
		Format( "m/d/y", 10 ),
		Input Format( "m/d/y" ),
		Set Selected,
		Set Values( [3755376000, 3755376000, 3758054400, 3758054400] )
	),
	New Column( "End Date",
		Numeric,
		"Continuous",
		Format( "m/d/y", 10 ),
		Input Format( "m/d/y" ),
		Set Selected,
		Set Values( [3760473600, 3763152000, 3765744000, 3768422400] )
	)
);

dt << New Column ("Duration", Set Formula (Date Difference (:Start Date, :End Date, "day")));

View solution in original post

1 REPLY 1

Re: Formule colonne

An easier way might be to use the Date Difference() function. Example below:

/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN.  BY USING THE CODE, YOU AGREE TO THESE TERMS.  YOUR USE OF THE CODE IS AT YOUR OWN RISK.  JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose.  The Code is designed to add functionality to the Software but has not necessarily been tested.  Accordingly, JMP makes no representation or warranty that the Code will operate error-free.  JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages.  Except as otherwise provided above, the Code is governed by the same agreement that governs the Software.  If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries.  ® indicates USA registration.  Other brand and product names are registered trademarks or trademarks of their respective companies.
*/

Names default to here (1);
dt = New Table( "Dates",
	Add Rows( 4 ),
	New Column( "Start Date",
		Numeric,
		"Continuous",
		Format( "m/d/y", 10 ),
		Input Format( "m/d/y" ),
		Set Selected,
		Set Values( [3755376000, 3755376000, 3758054400, 3758054400] )
	),
	New Column( "End Date",
		Numeric,
		"Continuous",
		Format( "m/d/y", 10 ),
		Input Format( "m/d/y" ),
		Set Selected,
		Set Values( [3760473600, 3763152000, 3765744000, 3768422400] )
	)
);

dt << New Column ("Duration", Set Formula (Date Difference (:Start Date, :End Date, "day")));