I'm rewriting a SAS code into STATA and had learned quickly the big difference between each software's if command (captured here in Cox's answer to my earlier question http://www.statalist.org/forums/foru...and-delimiters), that STATA nested ifs don't loop over.
But I'm wondering if there is any way to create "neater" looking conditionals in STATA. For example, something in SAS that looks like this,
if condition A {
if condition B {
will have to be written like this in STATA
do 1 if condition A & condition a
do 2 if condition A & condition b
do 3 if condition B & condition c
do 4 if condition B & condition d
which, with long conditionals and action commands, looks messy and is hard to keep track of. Any advice on this issue would be appreciated.
But I'm wondering if there is any way to create "neater" looking conditionals in STATA. For example, something in SAS that looks like this,
if condition A {
if condition a {[INDENT=2]do 1[/INDENT]
}
if condition b {[INDENT=2]do 2[/INDENT]
}}
if condition B {
if condition c {[INDENT=2]do 3[/INDENT]
}[INDENT=2]do 4[/INDENT]
if condition d {
}}
will have to be written like this in STATA
do 1 if condition A & condition a
do 2 if condition A & condition b
do 3 if condition B & condition c
do 4 if condition B & condition d
which, with long conditionals and action commands, looks messy and is hard to keep track of. Any advice on this issue would be appreciated.
Comment