On Saturday, February 12, 2011 05:08:06 am beky wrote: > There is a code from SPSS Syntax > > do if sub(ATVK,2,2)="01". > comp strata=1. > else if sub(ATVK,2,2)>="05" and sub(ATVK,2,2)<="27". > comp strata=3. > else if sub(ATVK,4,2)>"20" or sub(ATVK,6,2)>"20". > comp strata=4. > else if sub(ATVK,4,2)>"00". > comp strata=2. > end if. > > value labels strata 1 "R 2 "Li" 3 "M" 4 "La". > > How can i rewrite it in R code? It would be helpful if an example of data were included in your request. BTW, I believe there's a missing '"' in the last line of code. Shouldn't "R be "R"?
JWDougherty ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.