| Date: | Fri, 2 Oct 2009 16:31:33 +0200 |
| Reply-To: | Jara Kampmann <jarakampmann@GMX.NET> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | Jara Kampmann <jarakampmann@GMX.NET> |
| Subject: | STATA command into SPSS |
| Content-Type: | text/plain; charset="us-ascii" |
Hey everybody,
I am trying to write a small consistency check.
I have variables which should only have the values 1 | 2 | 8 | 9.
I would do the following:
Use a loop within which an if-function would filter all values which are not within the allowed range.
Then create a new dummy variable with the value 1 in case a wrong value is detected.
These new dummy variables should be given the name of the old variable plus the extension "_d".
List the original variables, the new dummy variables and the id, if the dummy variable has the value 1.
Close the loop.
I think this would work out quite well. The only problem is I am originally a STATA user, but now have to work with SPSS.
In STATA I would write the following syntax:
foreach x of varlist v10 v11 ...{
`x'_d = 1 if ((x<1) | ((x>2) & (x<8)) | (x>9))
list `x'_d x id if `x'_d==1
}
My main problem is to translate the part >>`x'_d<< . I cannot find a command to add an extension to a varlist in a loop.
Could someone please translate this into SPSS?
Or does someone know a website supplying support for STATA into SPSS translation?
Many thanks.
Jara
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
|