Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Math & Sciences (https://www.askmehelpdesk.com/forumdisplay.php?f=402)
-   -   Stata Command (https://www.askmehelpdesk.com/showthread.php?t=410786)

  • Oct 29, 2009, 01:42 AM
    Lot2Learn
    Stata Command
    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?
  • Oct 29, 2009, 06:08 AM
    ArcSine
    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
  • Oct 29, 2009, 08:20 AM
    Lot2Learn
    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.
  • Dec 3, 2009, 12:05 AM
    rajeshms
    You its correct...

  • All times are GMT -7. The time now is 01:45 PM.