The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » Too long command in Stata?
Too long command in Stata? [message #11605] Sun, 15 January 2017 08:56 Go to previous message
nwegbus is currently offline  nwegbus
Messages: 15
Registered: December 2015
Member
Hello,

I'm a doctoral student writing my dissertation using the Nigeria DHS 2013 and Stata 13. I'm trying to construct a variable -achild- (actual number of children) using 4 observed variables in the dataset -v202, v203, v204 and v205- which represent "sons at home, daughters at home, sons elsewhere and daughters elsewhere' respectively.

I'm doing this by generating my new variable and then doing a series of "replace ifs". Since some women have as many as 11 children in any of the four categories, my commands are extremely long and this is causing Stata to return this message:

"error . . . . . . . . . . . . . . . . . . . . . . . . Return code 130
expression too long;
too many SUMs;
In the first case, you specified an expression that is too long
for Stata to process -- the expression contains more than 249
pairs of nested parentheses or more than 800 dyadic operators.
(For Small Stata, the limit is 66 dyadic operators.) Break
the expression into smaller parts. In the second case, the
expression contains more than 5 sum() functions. This
expression, too, will have to be broken into smaller parts."

****Edited to add****
I have already tried using the "///" and "*/" symbols and breaking up the command into seven shorter lines instead of just four. It's still not working.

I'm convinced there is a more efficient way of doing what I'm trying to do in a shorter time, and using less lengthy commands. I just can't seem to figure it out.

Any guidance and suggestions/links would be highly appreciated.

Thank you
SN

[Updated on: Tue, 17 January 2017 15:22]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: stset for survival analysis for complex survey in IR files using Stata
Next Topic: Using community-level variables in regression models
Goto Forum:
  


Current Time: Sun Jul 28 02:17:38 Coordinated Universal Time 2024