Dear Allin,
your script works great. Just a comment, the variables should be ordered in
the same order that it is read? In the oringinal file I have "Prod_1" as a
variable, and in the second one I also have "Prod_1 = Oil", as in the txt
files of Gretl. I want to merge that for the same product it adds the
description (second column).
For the /Data/Variable labels, I have just two options: erase them, or
export them, but not import.
Thanks again for your script, with small modifications I will make it work.
Best
Leandro
2014/1/20 Allin Cottrell <cottrell(a)wfu.edu>
On Mon, 20 Jan 2014, Allin Cottrell wrote:
> On Mon, 20 Jan 2014, Leandro Zipitria wrote:
>
>> Dear Gretl users,
>>
>> I have a dataset that have 200 variables, all by the name prod_# (that
is,
>> a list of products from 1 to 200). I also have a csv with the
description
>> of that product (oil, ham, etc.).
>>
>> Is there any (simple) way of adding the information of each product to
the
>> description of the variable by reading the csv file? I know that it
could
>> be done "by hand" by editing each variable and copy and paste on the
>> description of the variable.
>
> Example (your case may vary somewhat) [...]
Ha, I was forgetting, there's the menu item /Data/Variable labels, which
also maps onto the "labels" command with the --from-file option.
To use that approach, your descriptive labels must be one per line, as in
my pnames.txt example. The scripting approach is more flexible: you could
use gretl's string-handling functions to deal with other cases such as
labels on one line, separated by commas.
Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users