Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generate sequencial dicotomic variable

    Hi all,

    I am trying to alternate position label (pos=6 and pos=12) in a scatter graph, for this purpose I am trying to generate sequencial dicotomic variable.

    For this purpose I am using labvposition package.

    Code example:

    Code:
    sysuse auto,clear
    collapse mpg, by(rep78)
    drop if missing(rep78)
    
    *Here I generate sequencial dicotomic variable:
    
    gen pos = 6
    replace pos = 12 if pos in 1/1
    replace pos = 12 if pos in 3/3
    replace pos = 12 if pos in 5/5
    
    scatter  mpg rep78, ///
        c(l) sort mlabel(mpg) mlabv(pos)
    Click image for larger version

Name:	Sin título.png
Views:	1
Size:	3.8 KB
ID:	1526709

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	10.2 KB
ID:	1526705





    Do you know other method to generate this sequencial dicotomic variable for 1000 obs?
    Thanks in advance
    Rodrigo

    Last edited by Rodrigo Badilla; 27 Nov 2019, 18:08.
Working...
X