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 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 26 Mar 2003 03:15:37 0
Reply-To:     Valentim António Alferes <valferes@FPCE.UC.PT>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Valentim António Alferes <valferes@FPCE.UC.PT>
Subject:      Re: Creating one variable out of multiple vars
Content-Type: text/plain; charset=iso-8859-1

Hi Bob,

* Your data (Example).

DATA LIST FREE/V1 TO V10. BEGIN DATA 1 1 1 0 0 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 0 1 0 1 0 0 1 0 1 1 END DATA.

* Method 1: Don’t look at the “9” of VARINT_1 or convert * VARINT_1 into a string variable and drop the “9”.

COMPUTE w=9. COMPUTE varint_1= w*10**10 + v1*10**9 + v2*10**8 + v3*10**7 + v4*10**6 + v5*10**5 + v6*10**4 + v7*10**3 + v8*10**2 + v9*10 + v10. EXECUTE. FORMATS varint_1 (F11.0). LIST varint_1.

* Method 2: The missing values in VARINT_2 before the * first “1” are all zeros.

COMPUTE varint_2=0. COMPUTE k=9. VECTOR x=v1 TO v10. LOOP i=0 TO k. COMPUTE varint_2=varint_2+x(i+1)*(10**(k-i)). END LOOP. FORMATS varint_2(F10.0). LIST varint_2.

Valentim Alferes

http://www.fpce.uc.pt/nucleos/niips/spss_prc/index.htm


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