user42459
user42459

Reputation: 915

Graphing two observations, not variables

The data looks like

year 1970 1971 1972
 num    3   1     4

But "graph twoway line year num" does not work here because they are not variable names.

What should I do?

Upvotes: 0

Views: 33

Answers (1)

Nick Cox
Nick Cox

Reputation: 37288

You need to transpose your data to do almost anything interesting or useful. You don't say what your variable names are, but here is some technique.

clear 
input str4 whatever x y z 
year 1970 1971 1972
 num    3   1     4
end 

xpose, clear 
drop in 1 
rename (v?) (year num) 

The names in your string variable won't get past the xpose but for your example it is trivial to rename what you get.

Upvotes: 1

Related Questions