LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2012)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 22 Mar 2012 12:28:05 +0000
Reply-To:     "Beckstead, Jason" <jbeckste@health.usf.edu>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Beckstead, Jason" <jbeckste@health.usf.edu>
Subject:      conditional compute within a macro
Content-Type: multipart/alternative;

Listers, I am trying to compute a lagged variable within a macro using CONDITIONAL, !IF !THEN, but having no luck. can anyone offer assistance? Below is simplified data set/structure and current macro attempt.

Thanks.

DATA LIST FREE/ ID DAY X. BEGIN DATA. 1 1 10 1 2 15 1 3 20 1 4 25 1 5 30 2 1 20 2 2 21 2 3 22 2 4 23 3 1 33 3 2 33 3 3 34 3 4 36 3 5 38 3 6 39 END DATA. COMPUTE LAGID=LAG(ID,1). LIST.

DEFINE !LAGGY (!POS = !TOKENS(1)). !IF (ID !EQ LAGID) !THEN COMPUTE !CONCAT('LAG1',!1) = LAG(!1,1). EXE. !IFEND. !ENDDEFINE. !LAGGY X. LIST.

_____________________________________________________________ Jason W. Beckstead, Ph.D. Associate Professor/Quantitative Methodologist University of South Florida College of Nursing 12901 Bruce B. Downs Blvd., MDC22, Tampa, FL 33612, USA Statistical Editor, International Journal of Nursing Studies phone: +1.813.974.7667 fax: +1.813.974.5418 personal website: http://personal.health.usf.edu/jbeckste/ International Journal of Nursing Studies http://www.elsevier.com/ijns


[text/html]


Back to: Top of message | Previous page | Main SPSSX-L page