I want to use the tsline command to plot my 2 series- insys_growth and spy_growth for the date ranges 02mar2015 to 31may2017
I used the command
Code:
tsline insys_close spy_close if 02mar2015<=edate<=30may2017
I also tried using the inrange command
Code:
tsline spy_growth insys_growth if inrange(date, 02mar2015, 31may2017)
A preview of my data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str8 date float(edate insys_growth spy_growth) "1/30/09" 17927 .1988509 4.4167905 "2/2/09" 17930 .016529638 4.4137673 "2/3/09" 17931 .016529638 4.4277167 "2/4/09" 17932 .1988509 4.4228086 "2/5/09" 17933 .3530013 4.4375796 "2/6/09" 17934 .3530013 4.465678 "2/9/09" 17937 .3530013 4.4670568 "2/10/09" 17938 .1988509 4.420165 "2/11/09" 17939 .3530013 4.4260435 "2/12/09" 17940 .3530013 4.426761 "2/13/09" 17941 .604316 4.415945 "2/16/09" 17944 .4865331 . "2/17/09" 17945 .016529638 4.3722286 "2/18/09" 17946 .4865331 4.3698277 "2/19/09" 17947 .1988509 4.359014 "2/20/09" 17948 .1988509 4.349245 "2/23/09" 17951 .1988509 4.3128104 "2/24/09" 17952 .1988509 4.35002 "2/25/09" 17953 .1988509 4.342116 "2/26/09" 17954 .1988509 4.325721 "2/27/09" 17955 .016529638 4.3031187 "3/2/09" 17958 -.2066147 4.25703 "3/3/09" 17959 .1988509 4.2494946 "3/4/09" 17960 .016529638 4.272909 end format %td edate
(Not sure why it's showing the date as 17927 and such, when it's actually in the 30may2017 format.)
I also want to round up the insys_growth and spy_growth decimals and format them to have to digits after the decimal point. For instance, 4.272909 would become 4.27. How can I do that?
Thank you!!
Shruti
0 Response to How can I make a line graph for data from a certain date range?
Post a Comment