cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-624715%22%20slang%3D%22fr-FR%22%20mode%3D%22NONE%22%3E%E5%88%97%E5%85%AC%E5%BC%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624715%22%20slang%3D%22fr-FR%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%A4%A7%E5%AE%B6%E5%A5%BD%EF%BC%8C%E6%88%91%E6%AD%A3%E5%9C%A8%E5%98%97%E8%A9%A6%E8%A3%BD%E4%BD%9C%E4%B8%80%E5%80%8B%20JMP%20%E8%85%B3%E6%9C%AC%E4%BE%86%E8%A8%88%E7%AE%97%E5%A2%9E%E9%87%8F%E6%8C%81%E7%BA%8C%E6%99%82%E9%96%93%E3%80%82%20%E6%88%91%E6%9C%89%20847%20%E5%80%8B%E9%96%8B%E5%A7%8B%E6%97%A5%E6%9C%9F%E5%88%97%EF%BC%8C847%20%E5%80%8B%E7%B5%90%E6%9D%9F%E6%97%A5%E6%9C%9F%E5%88%97%E3%80%82%20%E4%B8%8B%E9%9D%A2%E7%9A%84%E8%85%B3%E6%9C%AC%E4%BD%BF%E7%94%A8for%E5%BE%AA%E7%92%B0%E4%BE%86%E8%A8%88%E7%AE%97%E6%AF%8F%E5%88%97%E2%80%9Cduration%20task%20x%E2%80%9D%E7%9A%84%E6%96%B0%E5%80%BC%EF%BC%88%E5%BE%8C%E9%9D%A2%E5%B7%B2%E7%B6%93%E5%89%B5%E5%BB%BA%E7%9A%84%E5%88%97%EF%BC%8Cx%E7%9A%84%E7%AF%84%E5%9C%8D%E6%98%AF1%E5%88%B0847%EF%BC%89%E3%80%82%20%E6%84%9F%E8%AC%9D%E6%82%A8%E7%9A%84%E5%B9%AB%E5%8A%A9%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22hcarr01_0-1682063674841.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hcarr01_0-1682063674841.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hcarr01_0-1682063674841.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hcarr01_0-1682063674841.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hcarr01_0-1682063674841.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hcarr01_0-1682063674841.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hcarr01_0-1682063674841.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hcarr01_0-1682063674841.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hcarr01_0-1682063674841.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F52190iD4628FA724DF3ADF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22hcarr01_0-1682063674841.png%22%20alt%3D%22hcarr01_0-1682063674841.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-624715%22%20slang%3D%22fr-FR%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E8%85%B3%E6%9C%AC%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-624919%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%85%AC%E5%BC%8F%E5%86%92%E8%99%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624919%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E4%B8%80%E7%A8%AE%E6%9B%B4%E7%B0%A1%E5%96%AE%E7%9A%84%E6%96%B9%E6%B3%95%E5%8F%AF%E8%83%BD%E6%98%AF%E4%BD%BF%E7%94%A8%20Date%20Difference()%20%E5%87%BD%E6%95%B8%E3%80%82%20%E7%A4%BA%E4%BE%8B%E5%A6%82%E4%B8%8B%EF%BC%9A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F*JMP%20STATISTICAL%20DISCOVERY%20LLC%20(%E2%80%9CJMP%E2%80%9D)%20PERMITS%20THE%20USE%20OF%20THIS%20COMPUTER%20SOFTWARE%20CODE%20(%E2%80%9CCODE%E2%80%9D)%20ON%20AN%20AS-IS%20BASIS%20AND%20AUTHORIZES%20YOU%20TO%20USE%20THE%20CODE%20SUBJECT%20TO%20THE%20TERMS%20LISTED%20HEREIN.%20%20BY%20USING%20THE%20CODE%2C%20YOU%20AGREE%20TO%20THESE%20TERMS.%20%20YOUR%20USE%20OF%20THE%20CODE%20IS%20AT%20YOUR%20OWN%20RISK.%20%20JMP%20MAKES%20NO%20REPRESENTATION%20OR%20WARRANTY%2C%20EXPRESS%20OR%20IMPLIED%2C%20INCLUDING%20BUT%20NOT%20LIMITED%20TO%2C%20WARRANTIES%20OF%20MERCHANTABILITY%2C%20FITNESS%20FOR%20A%20PARTICULAR%20PURPOSE%2C%20NONINFRIGEMENT%2C%20AND%20TITLE%2C%20WITH%20RESPECT%20TO%20THE%20CODE.%0AYou%20may%20use%20the%20Code%20solely%20as%20part%20of%20a%20software%20product%20you%20currently%20have%20licensed%20from%20JMP%2C%20JMP%E2%80%99s%20parent%20company%20SAS%20Institute%20Inc.%20(%E2%80%9CSAS%E2%80%9D)%2C%20or%20one%20of%20JMP%E2%80%99s%20or%20SAS%E2%80%99s%20subsidiaries%20or%20authorized%20agents%20(the%20%E2%80%9CSoftware%E2%80%9D)%2C%20and%20not%20for%20any%20other%20purpose.%20%20The%20Code%20is%20designed%20to%20add%20functionality%20to%20the%20Software%20but%20has%20not%20necessarily%20been%20tested.%20%20Accordingly%2C%20JMP%20makes%20no%20representation%20or%20warranty%20that%20the%20Code%20will%20operate%20error-free.%20%20JMP%20is%20under%20no%20obligation%20to%20maintain%2C%20support%2C%20or%20continue%20to%20distribute%20the%20Code.%0ANeither%20JMP%20nor%20its%20licensors%20shall%20be%20liable%20to%20you%20or%20any%20third-party%20for%20any%20general%2C%20special%2C%20direct%2C%20indirect%2C%20consequential%2C%20incidental%2C%20or%20other%20damages%20whatsoever%20arising%20out%20of%20or%20related%20to%20your%20use%20or%20inability%20to%20use%20the%20Code%2C%20even%20if%20JMP%20has%20been%20advised%20of%20the%20possibility%20of%20such%20damages.%20%20Except%20as%20otherwise%20provided%20above%2C%20the%20Code%20is%20governed%20by%20the%20same%20agreement%20that%20governs%20the%20Software.%20%20If%20you%20do%20not%20have%20an%20existing%20agreement%20with%20JMP%20or%20SAS%20governing%20the%20Software%2C%20you%20may%20not%20use%20the%20Code.%0AJMP%20and%20all%20other%20JMP%20Statistical%20Discovery%20LLC%20product%20or%20service%20names%20are%20registered%20trademarks%20or%20trademarks%20of%20JMP%20Statistical%20Discovery%20LLC%20in%20the%20USA%20and%20other%20countries.%20%20%C2%AE%20indicates%20USA%20registration.%20%20Other%20brand%20and%20product%20names%20are%20registered%20trademarks%20or%20trademarks%20of%20their%20respective%20companies.%0A*%2F%0A%0ANames%20default%20to%20here%20(1)%3B%0Adt%20%3D%20New%20Table(%20%22Dates%22%2C%0A%20Add%20Rows(%204%20)%2C%0A%20New%20Column(%20%22Start%20Date%22%2C%0A%20%20Numeric%2C%0A%20%20%22Continuous%22%2C%0A%20%20Format(%20%22m%2Fd%2Fy%22%2C%2010%20)%2C%0A%20%20Input%20Format(%20%22m%2Fd%2Fy%22%20)%2C%0A%20%20Set%20Selected%2C%0A%20%20Set%20Values(%20%5B3755376000%2C%203755376000%2C%203758054400%2C%203758054400%5D%20)%0A%20)%2C%0A%20New%20Column(%20%22End%20Date%22%2C%0A%20%20Numeric%2C%0A%20%20%22Continuous%22%2C%0A%20%20Format(%20%22m%2Fd%2Fy%22%2C%2010%20)%2C%0A%20%20Input%20Format(%20%22m%2Fd%2Fy%22%20)%2C%0A%20%20Set%20Selected%2C%0A%20%20Set%20Values(%20%5B3760473600%2C%203763152000%2C%203765744000%2C%203768422400%5D%20)%0A%20)%0A)%3B%0A%0Adt%20%26lt%3B%26lt%3B%20New%20Column%20(%22Duration%22%2C%20Set%20Formula%20(Date%20Difference%20(%3AStart%20Date%2C%20%3AEnd%20Date%2C%20%22day%22)))%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
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")));