Dear Statalist users,

I have been trying to make the postfile command run from my do file and I keep getting back the error:

. do "C:\Users\HP\AppData\Local\Temp\STD2744_000000 .tmp "

. tempname myresults

. tempfile regresults

. postfile `myresults' lambda R-squared AdjR-squared SSR using regresults.dta , replace
- invalid name
r(198);

I have tried variations of the code:

Code:
tempname myresults
tempfile regresults
postfile `myresults' lambda R-squared AdjR-squared SSR using regresults.dta , replace
Code:
tempname myresults
tempfile regresults
postfile `myresults' lambda R-squared AdjR-squared SSR using "$DataDir\SDJW2020\Energy and Perceptions\Data\regresults.dta" , replace

Could somebody please help? I have looked at a lot of examples online and none of the syntax is working.