English 中文(简体)
SPSS Macro: 缩略语
原标题:SPSS Macro: compute by variable name
  • 时间:2012-01-13 21:20:11
  •  标签:
  • macros
  • spss

我不认为SPSS宏观能够回升价值,而不要分配诸如VIXL3 = !getLastAvail Target=VIX=3等值。 我估计,我需要做这样的事情:

/* computes last available entry of target at given level */
define !compLastAvail(name !Tokens(1) /target !Tokens(1) /level !Tokens(1))
   compute tmpid= $casenum.
   dataset copy tmpset1.
   select if not miss(!target).
   compute !name= lag(!target, !level).
   match files /file= * /file= tmpset1 /by tmpid.
   exec.
   delete variables tmpid.
   dataset close tmpset1.
!enddefine.

/* compute last values */

!compLastAvail name="VIXCL3" target=VIXC level=3.

The compute !name = ......is where the problem is.

How should this be done properly? The above returns:

>Error # 4285 in column 9.  Text: VIXCL3
>Incorrect variable name: either the name is more than 64 characters, or it is
>not defined by a previous command.
>Execution of this command stops.
最佳回答

When you pass tokens to the macro, they get interpreted literally. So when you specify

该表已转至相应的<代码>compute,作为VIXCL3>,而不只是一个没有引号的变量名称(例如VIXCL3)。

另有两项一般性建议;

  1. 如果在你执行宏观任务之前,你在<条码>上打上print,你将看到你把脚.传到宏观。 在此情况下,如果你采取这一步骤,你就会看到,这种犯罪是对声明和错误信息的补充。

  2. 有时,你会做什么用引标,如果是的话,则强硬指令! QUOTE和! UNQUOTE是手法。

问题回答

暂无回答




相关问题
C macro processing

I m thinking about best way to write C define processor that would be able to handle macros. Unfortunately nothing intelligent comes to my mind. It should behave exactly like one in C, so it handles ...

Macros as arguments to preprocessor directives

Being faced with the question whether it s possible to choose #includes in the preprocessor I immediately thought not possible. .. Only to later find out that it is indeed possible and you only need ...

Is there a profitable way to record user actions in textarea?

I need to send bunch of commands to the server on timer - like: put(0,"hello") del(4,1) put(4," is around the corner") so I need to monitor and record all of the user input and compile/flush it on ...

taking java method names as function arg in clojure

All, I want to create a function that takes a symbol representing a java method and applies it to some object: (user=> (defn f [m] (. "foo" (m))) When I execute this, I get a result much ...

Removing macro in legacy code

I have a lot of legacy code using macro of the form: #define FXX(x) pField->GetValue(x) The macro forces variable pField be in the scope: ..... FIELD *pField = .... ..... int i = FXX(3); int j = ...

eval during emacs lisp macro expansion

How can I fix the simple macro foo in (elisp)Eval During Expansion? None of the followings work: (defmacro foo1 (a) `(setq (eval ,a) t)) (defmacro foo2 (a) `(setq ,(eval a) t)) (defmacro foo3 (...

热门标签