graph - Stata-related graphic enquiry -
i have basic question stata. have repeated cross section of individuals year 1 year 20. each individual, year, have year-specific variable- gdp per capita in country instance. variable defined each individual each year, across years. therefore have 20 unique data points variable. want plot variable function of time (say in two-way plot). twoway command not work because have lot more 20 points 20 values because each value have defined on n number of people in cross section in year. how can create separate variable extracts distinct values variable in current form?
with simple example of data have saved , others time. stands, question difficult understand. pointed out, lacks both code , example data. please rewrite others can find , use whatever posted here.
my interpretation have panel data. variable gdp
year-specific (in every panel information duplicated), you'd graph against time. tag 1 instance, , draw graph conditional on that. example:
clear set more off // not 20 years, 3 input /// id year gdp 1 1990 78 1 1991 90 1 1992 98 2 1990 78 2 1991 90 2 1992 98 end egen tograph = tag(year) twoway line gdp year if tograph
or
twoway line gdp year if id == 1
Comments
Post a Comment