On Wed, 23 Sep 2009, Alan G Isaac wrote:

> User Guide 4.4 refers to the `import` command.
> It does not appear in the command ref.
> If you go to the console and type::
>
>       help import
>
> you are told `import` is not a gretl command.
> It is of course, but apparently undocumented?

Sorry, the Guide needs to be updated: "import" was once a gretl
command but it was subsumed under "open" some time ago. The reason
"import" will still work as a command is that it is declared
(internally) as an alias for "open" in order to preserve backward
compatibility.  We need to replace all references to an "import"
command in the Guide.

> I'd like to import data from a CSV file.
> I'd like to do this in a script.
> In addition to being able to specify the date
> range,I need the following functionality:
>
> skiplines: the number of lines to skip at the
>       beginning of the file
> usecols: which columns to use for data
> varnames: specify names (which are not in the CSV file)
>
> Possible?

Well, the --cols option to "open" lets you set the specs for
reading columns, and may do what you want.  We don't have a
"skiplines" option, though lines should automatically be skipped
if they start with '#'.  One could fairly easily write a shell
command to preprocess the data and execute it via "! <shell>"
in gretl.

If no varnames are present the series will be named v1, v2, etc.,
and you can use "rename" to attach meaningful names.

> Finally, if specifying the date range is not possible,
> is it possible to reset the dataset structure at the
> command line (rather than via menus)?

Yes, via setobs (as you noted).

Allin.

Reply via email to