difficulty with name command for graph

difficulty with name command for graph

by Anne Richards -
Number of replies: 7

I am getting the following error: invalid 'name'

when I try to name my graph.  Here are the commands I am using:

twoway (qfitci logscore_educadjust hours_of_sleep_per_night), ///
ytitle(Education-Adjusted Log Score) ytitle(, size(medium) margin(small)) ///
ylabel(, nogrid) xtitle(Hours of Sleep Per Night) xtitle(, size(medium) ///
margin(medium)) xmtick(3(1)11) title(Log-Score by Nightly Sleep Duration - ///
Speed Match, size(medium) position(12) margin(large)) scheme(s2mono) ///
graphregion(fcolor(white)), if unique & game == "Speed Match" ///
name(Final Project_Graph, replace) ///
saving("Final Project_Graph.gph", replace)

 

Thank you,

Anne

In reply to Anne Richards

Re: difficulty with name command for graph

by Bardia -

Your name must be in " ", for example: name("graphname",replace)

In reply to Bardia

Re: difficulty with name command for graph

by Anne Richards -

Thank you, however that doesn't work and is not how the naming command is demonstrated in lab 6 or in the sample Final Project. Any other ideas?

In reply to Anne Richards

Re: difficulty with name command for graph

by Mark Pletcher -

Try taking out the space?:

name(Final_Project_Graph, replace)

instead of:

name(Final Project_Graph, replace)

Does that work?

In reply to Mark Pletcher

Re: difficulty with name command for graph

by Anne Richards -

Thank you but unfortunately not. I've removed the space, placed it in again.  This happened before (Wayne and I discussed) and removing the space solved the problem but it's not working now! Bizarre.

In reply to Anne Richards

Re: difficulty with name command for graph

by Wayne Enanoria -

I am not sure what is happening and this one is difficult to do over the Forum. 

In reply to Anne Richards

Re: difficulty with name command for graph

by Mark Pletcher -

Sorry, no other ideas.  For some reason that "name" subcommand has been problematic in Stata 14 this year.  I recommend emailing Stata for help - they are very responsive.

Note that you don't need to name it for the Final Project, just need to get an image into Word (or PDF directly).

In reply to Anne Richards

Re: difficulty with name command for graph

by Wayne Enanoria -

Anne, 

I just responded to your email as well. Try taking out the comma after "graph region(color(white))". There is already a comma that separates the main command from the options at the end of the line of the twoway command. If you are subletting your data for the plot (and using 'if unique & game == "Speed Match"'), put any subsetting criteria before the comma at the end of the first line (that starts twoway…).