Export API call from Stata

User Jonathan has sent the following question:

… I am currently trying to write an export script. The script is giving me errors. Here below is the script I have written.

.export , qid (SOMEGUID$VER) saveto ("SOMEFILEANDPATH.DTA") [ replace ] [ translationid () includemeta status (true) exporttype () from () to ()

The error I get is here below;

class type not found
r(4018)

I am interested in learning how I can successfully export the data using the API…

The Documentation for the Stata API client lists the syntax of particular methods. We apply them to the object of class .SuSo that has been downloaded when the module is installed, which is the second line in the code of this post.

.s=.SuSo.new ……
.s.Export……

One can find additional details in Stata’s class programming manual:
help classman

Omitting the object name causes Stata to treat .Export as the class name, which it doesn’t find, hence the error 4018.

Hope this helps.
Best, Sergiy