I am having trouble using piece from the extended functions. The help for extended functions lists the syntax but doesn't give any usage examples. I've also searched online for examples but haven't found much. Here's what I'm trying to do. Can someone tell me why it doesn't work?
Here's the error I get:
Context: I want to store strings longer than 80 characters (pre-existing from American Community Survey) in the variable characteristics, since they are too long for the variable labels. I will then pull them into automated graphs to wrap around lines in the title or caption. Something like:
On a related note, I've been using the following code from an old Statalist post, I believe by Nick Cox. I don't understand the syntax of the quotes. Why "`...'" ? Maybe I need something similar to make the piece code work? Thanks.
Code:
version 11.2 char hd01_vd01[one] Testing Hello Can You Hear Me local var hd01_vd01 display `"`var'"' local var_char : char `var'[one] display `"`var_char'"' local var_char1 : piece 1 3 `"`var_char'"', nobreak display `"`var_char1'"'
Code:
. local var_char1 : piece 1 3 `"`var_char'"' invalid syntax r(198);
Context: I want to store strings longer than 80 characters (pre-existing from American Community Survey) in the variable characteristics, since they are too long for the variable labels. I will then pull them into automated graphs to wrap around lines in the title or caption. Something like:
Code:
title(`"`var_char1'"' `"`var_char2'"' `"`var_char3'"')
Code:
local var_label "`: variable label `var''"
Comment