여러 열의 값 계산안녕하십니까,
저는 주로 SPSS 사용자이고 JMP를 처음 사용하며 JMP에서 "케이스 내 값 계산"과 유사한/동일한 SPSS 기능을 찾고 싶습니다.
'전혀 그렇지 않다', (0) '약간', 1) '보통', 2) '보통', 3), '매우 그렇다'(4) 중 하나를 응답한 응답자의 수를 계산하고 싶습니다. Know_1에서 Know_3까지 열에 걸쳐 있습니다.
그런 다음 "지식 평가에서 응답자 중 35명이 "보통"으로 응답했습니다"와 같은 결론을 도출하기 위해 각 답변과 함께 총 응답자 수가 있는 "Know_total"이라는 별도의 열을 만들겠습니다.
SPSS에서는 2단계 프로세스이기 때문에(특정 값의 수를 세고 다른 열에서 원하는 값으로 다시 코딩) 그래서 내 질문을 그런 식으로 표현했지만 더 빠른 옵션이 있으면 교육해 주세요. .
JSL인지 아닌지 상관하지 않습니다 

Re: 여러 열의 값 계산변수 New를 사용하여 "New"라는 데이터 세트를 참조하고 있습니다. 그러나 변수는 아무 것도 가리키지 않습니다. 이렇게 하면 문제가 해결됩니다.
dt1 = data table("New");
dt2 = dt1 << Stack(
columns( :Know_1, :Know_2, :Know_3 ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" )
);Re: 여러 열의 값 계산안녕하십니까, pmroz
맞습니다. 하지만 내 데이터 세트의 이름("New")으로 시도했을 때 스크립트가 작동하지 않았습니다(아무 일도 일어나지 않은 것처럼 TT).
그리고 나는 모든 스크립트 시퀀스가 어떻게든 필요하고 아마도 스크립트의 첫 번째 시퀀스와 관련이 있을 것이라고 가정했습니다...
여기서 내가 무엇을 잘못했는지 골라주시겠습니까?
dt2 <SPAN class="token operator">=</SPAN> New <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> Stack<SPAN class="token punctuation">(</SPAN>
columns<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Know_1<SPAN class="token punctuation">,</SPAN> <SPAN class="token punctuation">:</SPAN>Know_2<SPAN class="token punctuation">,</SPAN> <SPAN class="token punctuation">:</SPAN>Know_3 <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Source Label <SPAN class="token function">Column</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"Label"</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Stacked Data <SPAN class="token function">Column</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"Data"</SPAN> <SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
dt2 <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> <SPAN class="token function">New Column</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"Value"</SPAN><SPAN class="token punctuation">,</SPAN> Character<SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Nominal"</SPAN><SPAN class="token punctuation">,</SPAN>
Formula<SPAN class="token punctuation">(</SPAN>
<SPAN class="token function">If</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Data <SPAN class="token operator">==</SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Not at all"</SPAN><SPAN class="token punctuation">,</SPAN>
<SPAN class="token punctuation">:</SPAN>Data <SPAN class="token operator">==</SPAN> <SPAN class="token number">1</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Slightly"</SPAN><SPAN class="token punctuation">,</SPAN>
<SPAN class="token punctuation">:</SPAN>Data <SPAN class="token operator">==</SPAN> <SPAN class="token number">2</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Somewhat"</SPAN><SPAN class="token punctuation">,</SPAN>
<SPAN class="token punctuation">:</SPAN>Data <SPAN class="token operator">==</SPAN> <SPAN class="token number">3</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Moderately"</SPAN><SPAN class="token punctuation">,</SPAN>
<SPAN class="token punctuation">:</SPAN>Data <SPAN class="token operator">==</SPAN> <SPAN class="token number">4</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Extremely"</SPAN>
<SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
dtab <SPAN class="token operator">=</SPAN> dt2 <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> Tabulate<SPAN class="token punctuation">(</SPAN>
<SPAN class="token function">Show</SPAN> Control Panel<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">0</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
<SPAN class="token function">Add</SPAN> Table<SPAN class="token punctuation">(</SPAN> <SPAN class="token function">Row</SPAN> Table<SPAN class="token punctuation">(</SPAN> Grouping Columns<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>Value <SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
고맙습니다
Re: 여러 열의 값 계산우리는 더미 테이블을 만들고 SET VALUES 명령으로 값을 추가했습니다. 귀하의 데이터가 이미 테이블에 있다고 예상하십니까?
Re: 여러 열의 값 계산
안녕하십니까 pmroz 그리고 ian_jmp 신속한 응답에 감사드립니다!
Set Values([])에 대한 질문이 하나 더 있습니다.
총 3,465개의 행이 있으며 다음과 같이 보일 것입니다.
dt1 = 새 테이블( "", 행 추가( 3,465 ),
...?
따라서 귀하가 제공한 스크립트에서 설정 값은 행 1에서 행 6까지의 숫자 값이며 행 번호가 변경되면 설정 값 스크립트도 변경된다는 것을 이해합니다.
그러나 나는 그것이하는 일을 이해하지 못합니다 ... 죄송합니다. JSL에 익숙하지 않습니다.
Re: 여러 열의 값 계산매우 기능적인 Categorical 플랫폼 사용을 고려할 수도 있습니다. 아래 코드는 위의 예를 재현한 것입니다.
NamesDefaultToHere(1);
// Test data with 'Value Labels'
dt = New Table( "Test",
Add Rows( 6 ),
New Column( "Know_1",
Numeric,
"Ordinal",
Format( "Best", 12 ),
Value Labels(
{0 = "Not at all", 1 = "Slightly", 2 = "Somewhat", 3 = "Moderately", 4 = "Extremely"}
),
Use Value Labels( 1 ),
Set Values( [2, 1, 2, 3, 4, 2] )
),
New Column( "Know_2",
Numeric,
"Ordinal",
Format( "Best", 12 ),
Value Labels(
{0 = "Not at all", 1 = "Slightly", 2 = "Somewhat", 3 = "Moderately", 4 = "Extremely"}
),
Use Value Labels( 1 ),
Set Values( [2, 1, 2, 4, 2, 3] )
),
New Column( "Know_3",
Numeric,
"Ordinal",
Format( "Best", 12 ),
Value Labels(
{0 = "Not at all", 1 = "Slightly", 2 = "Somewhat", 3 = "Moderately", 4 = "Extremely"}
),
Use Value Labels( 1 ),
Set Values( [0, 1, 1, 1, 2, 4] )
)
);
// Try 'Analyze > Consumer Research > Categorical' with 'Multiple Resoponses'
dt << Categorical( Multiple Response( :Know_1, :Know_2, :Know_3 ), Legend( 0 ) );Re: 여러 열의 값 계산다음은 수식 열인 STACK과 TABULATE를 사용하는 접근 방식입니다. 나는 원래 테이블에 답에 대한 숫자가 있다고 가정했습니다.
dt1 = New Table( "", Add Rows( 6 ),
New Column( "Know_1", Numeric, "Ordinal", Format( "Best", 12 ),
Set Values( [2, 1, 2, 3, 4, 2] )
),
New Column( "Know_2", Numeric, "Ordinal", Format( "Best", 12 ),
Set Values( [2, 1, 2, 4, 2, 3] )
),
New Column( "Know_3", Numeric, "Ordinal", Format( "Best", 12 ),
Set Values( [0, 1, 1, 1, 2, 4] )
)
);
dt2 = dt1 << Stack(
columns( :Know_1, :Know_2, :Know_3 ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" )
);
dt2 << New Column( "Value", Character, "Nominal",
Formula(
If( :Data == 0, "Not at all",
:Data == 1, "Slightly",
:Data == 2, "Somewhat",
:Data == 3, "Moderately",
:Data == 4, "Extremely"
)
)
);
dtab = dt2 << Tabulate(
Show Control Panel( 0 ),
Add Table( Row Table( Grouping Columns( :Value ) ) )
);