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%EC%97%B4%20%EC%88%98%EC%8B%9D%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624715%22%20slang%3D%22fr-FR%22%20mode%3D%22NONE%22%3E%3CP%3E%EC%95%88%EB%85%95%ED%95%98%EC%84%B8%EC%9A%94%20%EC%97%AC%EB%9F%AC%EB%B6%84%2C%20%EB%8D%B8%ED%83%80%20%EA%B8%B0%EA%B0%84%EC%9D%84%20%EA%B3%84%EC%82%B0%ED%95%98%EA%B8%B0%20%EC%9C%84%ED%95%B4%20JMP%20%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8%EB%A5%BC%20%EB%A7%8C%EB%93%A4%EB%A0%A4%EA%B3%A0%20%ED%95%A9%EB%8B%88%EB%8B%A4.%20847%EA%B0%9C%EC%9D%98%20%EC%8B%9C%EC%9E%91%20%EB%82%A0%EC%A7%9C%20%EC%97%B4%EA%B3%BC%20847%EA%B0%9C%EC%9D%98%20%EC%A2%85%EB%A3%8C%20%EB%82%A0%EC%A7%9C%20%EC%97%B4%EC%9D%B4%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%EC%95%84%EB%9E%98%20%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8%EB%8A%94%20for%20%EB%A3%A8%ED%94%84%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%EA%B0%81%20%EC%97%B4%20%22duration%20task%20x%22(%EB%82%98%EC%A4%91%EC%97%90%20%EC%9D%B4%EB%AF%B8%20%EC%83%9D%EC%84%B1%EB%90%9C%20%EC%97%B4%2C%20x%20%EB%B2%94%EC%9C%84%EB%8A%94%201~847)%EC%9D%98%20%EC%83%88%20%EA%B0%92%EC%9D%84%20%EA%B3%84%EC%82%B0%ED%95%A9%EB%8B%88%EB%8B%A4.%20%EB%8B%B9%EC%8B%A0%EC%9D%98%20%EB%8F%84%EC%9B%80%EC%9D%84%20%EC%A3%BC%EC%85%94%EC%84%9C%20%EA%B0%90%EC%82%AC%ED%95%A9%EB%8B%88%EB%8B%A4.%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%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%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%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8C%85%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%3ERe%3A%20%ED%8F%AC%EB%AE%AC%EB%9F%AC%20%EC%BD%9C%EB%A1%A0%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-624919%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EB%8D%94%20%EC%89%AC%EC%9A%B4%20%EB%B0%A9%EB%B2%95%EC%9D%80%20Date%20Difference()%20%ED%95%A8%EC%88%98%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94%20%EA%B2%83%EC%9E%85%EB%8B%88%EB%8B%A4.%20%EC%95%84%EB%9E%98%20%EC%98%88%3A%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")));