Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: A tricky graph to make

From   "Dimitriy V. Masterov" <[email protected]>
To   [email protected]
Subject   Re: st: A tricky graph to make
Date   Tue, 14 Oct 2003 16:04:12 -0500 (CDT)

I think one quick and dirty way of doing this may involve reshaping the

/*this step converts the variables score and year from string to numeric,
so if they were not strings it is unnecessary*/

destring score, replace;
destring year, replace;

/* This step will convert the data assuming that country is a string. If
not, omit string at the end of the command*/
reshape wide score, i(year) j(country) string;

/* This step is here because I am lazy. If you have a lot of countries, it
will save you some typing */
local list score*;
unab list: `list';
local graph "";

#delimit cr
foreach var of varlist `list' {
	local graph "`graph' (line `var' year, sort) "

/* graphs the scores */
twoway `graph'

I think this should work.


Dimitriy V. Masterov

Center for Social Program Evaluation
1155 East 60th St. Room 038
Chicago, IL 60637
Work: (773)256-6005
Fax: (773)256-6313

1312 East 53rd St., Apt.309
Chicago, IL 60615
Mobile: (773)220-2760

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index