I have 227 variables that are grouped by common prefixes. I am trying to use the unab command to create lists of each variable group by prefix, per this forum post. I will then use these prefix-specific lists to create new variables later on.
I receive the following error: invalid syntax r(198);
I believe my in-loop reference to the local macro, prefixes, containing the list of prefixes is somehow causing the syntax error. My code is below, followed by some of the output using set trace on.
Trying the different quote formats in the linked post, including compound quotes, I've had no luck resolving the error. If anybody could point out the syntax error it would be much appreciated!
Code:
*local prefixes "ad_3n" "ad_county" "ad_mh" "ad_offcat" "ad_secondstrike" "ad_senttype" "cust_age" "cust_cob" "cust_ethnicity" "cust_genderage" "cust_housing" "cust_mh" "cust_offcat" "cust_risk" "cust_secondstrike" "cust_senttype" "cust_servio" "cust_sexreg" "par_3n" "par_age" "par_atlarge" "par_caseload" "par_ethnicity" "par_mh" "par_offcat" "par_region" "par_secondstrike" "par_senttype" "par_servio" "par_sexreg" "rel_length" "rel_reltype" "rel_senttype" "rel_senttype_length" "rel_sexreg" di "`prefixes'" foreach prefix of local prefixes { unab `prefix'_list : `prefix'* di "`prefix'_list" } **** FROM SET TRACE ON **** - foreach prefix of local prefixes { - unab `prefix'_list : `prefix'* = unab ad_3n"_list : ad_3n"* --------------------------------------------------------------------------------------------------------------------- begin unab --- - version 6 - gettoken user 0: 0, parse(" :") - gettoken colon 0: 0, parse(" :") - if `"`colon'"' != ":" { error 198 } = if `""' != ":" { error 198 } invalid syntax ----------------------------------------------------------------------------------------------------------------------- end unab --- di "`prefix'_list" } r(198);
0 Response to Referring to local macros using unab
Post a Comment