I´m getting an error in my code when using post command but I don´t know why. The code is reproducible with auto dataset:


Code:
clear all

tempfile locations
tempname locat

postfile `locat' str32(x1 x2 x3 x4) using `locations', replace

sysuse auto

gen population = 1

gen domestico = 1 if foreign == 0
gen externo = 1 if foreign == 1

gen alto = 1 if gear_ratio <= 2
gen bajo = 1 if gear_ratio > 2

gen cost_h = 1 if price >= 10000
gen cost_l = 1 if price < 10000


local place "domestico externo"
local gear_l "alto bajo"
local cost "cost_h cost_l"


foreach p of local place{
    foreach g of local gear_l{
        foreach c of local cost{
                
        summ population  if `c'== 1 & `g' == 1 & `p' == 1
        local r = r(N)
        
        dis "`p'" "`g'" "`c'"  "`r'"
    
        post `locat' ("`c'")("`g'")("`p'")("`r'")
    
        }
    }        
}
Code:
unknown function () post:  above message corresponds to expression 1, variable x1
I´ve tried changing the type of variable in str32() for each variable but nothing works. Thanks