Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: mata orgtype

From   Tomáš Houška <>
Subject   st: mata orgtype
Date   Tue, 23 Apr 2013 01:29:45 +0200

Dear Statalist,

I have a Stata macro generated by -levelsof- and I am trying to parse
it in mata with -tokens- so that I can run mata loops with it...

levelsof product, local(product_id)
for(i = 1; i<=length(prods); i++) {
... commands including prods[i] ...

My problem is that on some types of variables, the resulting mata item
(in this case "prods") is a row vector, but sometimes it is a scalar
string. Once it is a scalar string, I cannot refer to items on
individual positions by -prods[i]- as I can do when it is a row
Is there a rule to which type gets created and when? Or is there a way
to make sure that row vector  gets created?
Thank you
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index