cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
%3CLINGO-SUB%20id%3D%22lingo-sub-59357%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ECreating%20a%20Variable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-59357%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EI%20have%20an%20issue%20while%20creating%20an%20overall%20measure%20of%20time.%20I%20have%20attached%20a%20screenshot%20that%20shows%20what%20the%20data%20looks%20like%20thus%20far.%20I%20need%20to%20now%20create%20a%20variable%20that%20is%20called%20%22time%20in%20trial%22%20where%20I%20basically%20take%20the%20%22Nback%20start%22%20minus%20the%20%22Nback%20stop.%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMore%20specifically%20I%20would%20need%20several%20things%20to%20happen.%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20When%20%22Nback%20%23%20of%20letters%20presented%22%20equals%201%20the%20%22time%20in%20trial%22%20should%20equal%200.%20Then%20as%20the%26nbsp%3B%3CSPAN%3E%22Nback%20%23%20of%20letters%20presented%22%20increases%20the%20%22time%20in%20trial%22%20should%20also%20increase.%26nbsp%3B%3CBR%20%2F%3E2.%20This%20increase%20should%20stop%20when%20I%20reach%20another%201%20in%26nbsp%3B%22Nback%20%23%20of%20letters%20presented%22%20and%20start%20back%20over%20at%200%20for%20%22time%20in%20trial.%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F10983iA108AA3E172D24B9%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3EAny%20guidance%20would%20be%20greatly%20appreciated.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-59359%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Creating%20a%20Variable%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-59359%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EIf%20there%20are%20no%20gaps%20in%20the%20sequence%20for%26nbsp%3B%3CEM%3ENback%20%23%20of%20letters%20presented%26nbsp%3B%3C%2FEM%3Ethen%20I%20think%20the%20formula%20for%20%3CEM%3ETime%20in%20Trial%3C%2FEM%3E%20is%20just%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3ANBack%23%20of%20Letters%20Presented%20-%201%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20there%20are%20gaps%2C%20then%20you'll%20need%26nbsp%3Ba%20formula%20that%20combints%20%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2F14%2Fconditional-functions.shtml%23114881%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Econditional%20If()%3C%2FA%3E%20to%20check%20whether%20%3CEM%3ENback%23%20letters%3C%2FEM%3E%20is%201%20and%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2F14%2Frow-functions.shtml%23246746%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ELag()%20function%3C%2FA%3E%20to%20get%20the%20value%20of%20%3CEM%3ETime%20in%20Trial%3C%2FEM%3E%20in%20the%20previous%20row%20so%20you%20can%20increment%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JMPScreenSnapz217.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPScreenSnapz217.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JMPScreenSnapz217.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F10984iDD11EB9C6A198A58%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22JMPScreenSnapz217.png%22%20alt%3D%22JMPScreenSnapz217.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
tlsimons
Level I

Creating a Variable

I have an issue while creating an overall measure of time. I have attached a screenshot that shows what the data looks like thus far. I need to now create a variable that is called "time in trial" where I basically take the "Nback start" minus the "Nback stop."

 

More specifically I would need several things to happen. 

1. When "Nback # of letters presented" equals 1 the "time in trial" should equal 0. Then as the "Nback # of letters presented" increases the "time in trial" should also increase. 
2. This increase should stop when I reach another 1 in "Nback # of letters presented" and start back over at 0 for "time in trial."


image.png
Any guidance would be greatly appreciated. 

1 REPLY 1
Jeff_Perkinson
Community Manager Community Manager

Re: Creating a Variable

If there are no gaps in the sequence for Nback # of letters presented then I think the formula for Time in Trial is just:

 

:NBack# of Letters Presented - 1

 

If there are gaps, then you'll need a formula that combints conditional If() to check whether Nback# letters is 1 and the Lag() function to get the value of Time in Trial in the previous row so you can increment it.

 

JMPScreenSnapz217.png

 

-Jeff