PDA

View Full Version : Stata Command


Lot2Learn
Oct 29, 2009, 01:42 AM
I want to create a variable with a specific range. For instance, this is the command I used:

.gen Rel = 0
.replace Rel = 5 if rel_pref > 2 & < 9

I received an error message that said < 9 was invalid. But there is a value 9. So is there something wrong with the command?

ArcSine
Oct 29, 2009, 06:08 AM
I'm not familiar with Stata's syntax, but here's a shot in the dark: Maybe you need to explicitly specify the variable for both of the inequalities, as in

[variable] > 2 & [variable] < 9

Lot2Learn
Oct 29, 2009, 08:20 AM
Thanks a lot! I tried it and it worked. I'm kind of new at Stata, and I don't always understand their help guides as they are written so technically.

I really appreciate your help.

rajeshms
Dec 3, 2009, 12:05 AM
You its correct...