2017-11-28 22 views
2

私は頻繁に使用するSPSS構文をいくつかの場所で発生するテキスト文字列をいくつか持っています。複数の場所で文字列を変更しないようにするには、文字列を変数に代入する方法がありますか? (に類似した "X < - " Rで)SPSSで変数を代入する方法はありますか(x < - "文字列値")、多構文の場所で使用するには?

x <- "repeated string example" 
syntax object 1 = X. 
... 
syntax object n = X. 

ありがとうございました!

答えて

2

これはSPSSマクロ言語の最も簡単な使用方法です。例:

* first you define the macro . 
define !MyString() "repeated string example" !enddefine. 
define !AnotherString() "ample" !enddefine. 

* now you can use it in the syntax as in the following examples. 
string SomeStringVar (a30). 
compute SomeStringVar = !MyString. 
compute MyIndex=char.index(!MyString, !AnotherString). 
if someVar=!MyString cond=1.