Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Transformations

From   "Jason Payne" <[email protected]>
To   <[email protected]>
Subject   st: Transformations
Date   Wed, 11 Feb 2004 11:43:35 +1100

Dear STATAlistservers

I am trying to transform data in variables.  What is the equivalent STATA syntax for this SPSS command

if (var1=2) var2=1.

The closest I have come is the recode/generate command:  

recode var1 (2=1), generate(var2)

This syntax only works if you want to create a new variable, however in some cases I might with to modify an existing variable for one case only.  This is particularly useful in cleaning string variables where there are spelling mistakes.  In SPSS I would just type:

if (caseid=1) stringvar='SPSS'.
if (caseid=2) stringvar='STATA'.

Is there an equivalent for STATA syntax to make data transformations on existing variables, where the desired change is for just one case?

I hope this makes sense,

Kind Regards,

Jason Payne
Jason Payne
Violence, Property Crime and Drugs
Australian Institute of Criminology
GPO Box 2944 Canberra ACT 2601

E-mail: [email protected]
Tel +61 2 6260 9283 Fax +61 2 6260 9201

Visit the AIC homepage

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index