Hi; This is what I think is a very simple forvalues question. I'm trying to create a report listing the values for a number of variables by observation. Unfortunately, 'list' by itself won't work because the total goes over 255 characters (and then some). So, the idea here is, for each observation, list the values of some variables on one line, some on the second line, etc., then move on to the same thing for the next observation.
This can be accomplished with consecutive list commands restricted by observation as such:
list var1 var2 if _n==1
list q1b if index==1

This is obviously impractical. My idea here was a forvalues loop (I'm embarrassingly inexperienced here) with separate list commands for each set of variables like this;
local N = _N
forvalues i = 1/`N' {
list var1 var2
list var3 var4
}
However, what this gets me is the the output for the first list command for all the observations followed the output of the second list command for all the observations. It looks like this

If someone could tell me the obvious thing I'm missing here to get the list commands to output consecutively for each observation (or another type of solution to this problem) it would be greatly appreciated.
(Stata 12)
Best,
Jack
This can be accomplished with consecutive list commands restricted by observation as such:
list var1 var2 if _n==1
list q1b if index==1
This is obviously impractical. My idea here was a forvalues loop (I'm embarrassingly inexperienced here) with separate list commands for each set of variables like this;
local N = _N
forvalues i = 1/`N' {
list var1 var2
list var3 var4
}
However, what this gets me is the the output for the first list command for all the observations followed the output of the second list command for all the observations. It looks like this
If someone could tell me the obvious thing I'm missing here to get the list commands to output consecutively for each observation (or another type of solution to this problem) it would be greatly appreciated.
(Stata 12)
Best,
Jack
Comment