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 (May 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 1 May 2003 16:56:15 -0400
Reply-To:     Richard Ristow <>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Richard Ristow <>
Subject:      Re: Dynamic Variable Creation
Comments: To: "Richard J. Reeves" <>
In-Reply-To:  < .edu>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 12:30 PM 5/1/2003 -0400, Richard J. Reeves wrote:

>I have a dataset from a server that has visiting history. I am trying >to create counter variables to track how many times a given user >visits a given page. Currently the data is in this format: > >id page >-- ---- >j2 home.htm >jj2 index.htm >jj2 home.htm >r2 home.htm >t4 jkl.htm >t4 report.asp >t4 test.asp > >There are over 1000 pages and over 1000 user ides and both change >regularly so I would like a way to dynamically code the variable names >(or labels) so that I know how many times a person visited a given >page. I tried using some vectors with a double loop but could not >quite get there. I am wonder if there is a script solution or of this >simply can't be done.

To start with, the natural solutions do not create multitudes of variables. If you want one CASE to count the number of times a given user visits a page, it's very quick:


You can write a separate file instead of using "OUTFILE=*", of course.

If you really want a bunch of variables, look at CASESTOVARS, which will create variables dynamically from the data. Here's a response to a similar query, posted by Karel Asselberghs <asselberghs@XS4ALL.NL> Mon, 10 Mar 2003 13:25:15 +0100 ("Re: Aggregate functions") -- I've changed variable names for your case:

>split file by ID. >casestovars. >split file off.

That should (I'm a couple of releases back, and don't have CASESTOVARS) give you one case per ID, and one variable per page visited.

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